10.0.0 - 2024-11-24
- [breaking]
odbc-api
will now use narrow function calls by default on non-windows systems. This assumes that the ODBC driver on that platform uses UTF-8 encoding. This is usually the case as many Linux systems use an UTF-8 locale. Outside of windows the wide function calls are usually less battle tested on drivers. Downstream artefacts likearrow-odbc
andodbc2parquet
therefore have been compiling with thenarrow
flag on non-windows systems for quite a while now to opt into the behavior which most likely works by default. However if somebody had a non-windows platform with a non-utf 8 local and a driver which actually could use UTF-16, he could not set appropriate compiler flags to revert thenarrow
feature added by these crates. Since the default behavior for each platform is now triggered byodbc-api
itself, downstream artefacts can overwrite it both ways. E.g. using thenarrow
flag on windows to get some speed, if they know their target platform has a UTF-8 local configured. Or the other way around using thewide
flag on a Linux system to e.g. handle special character in column names, which only seem to work with the wide variants of the drivers. So if you usedodbc-api
previously on Linux without any flags it did by default use thewide
function calls. It now uses thenarrow
ones by default. If you want the old behavior just specify thewide
feature flag. For windows users nothing breaks.
- (deps) bump thiserror from 2.0.0 to 2.0.3
- (deps) bump csv from 1.3.0 to 1.3.1
- (deps) bump tempfile from 3.13.0 to 3.14.0
- (deps) bump tokio from 1.41.0 to 1.41.1
- (deps) bump thiserror from 1.0.68 to 2.0.0
- (deps) bump anyhow from 1.0.92 to 1.0.93
- (deps) bump thiserror from 1.0.66 to 1.0.68
- (deps) bump thiserror from 1.0.65 to 1.0.66
- (deps) bump anyhow from 1.0.91 to 1.0.92
- (deps) bump syn from 2.0.87 to 2.0.89
- (deps) bump syn from 2.0.86 to 2.0.87
- (deps) bump syn from 2.0.85 to 2.0.86
ConcurrentBlockCursor
is now generic over the buffer type
- Fix failed release 8.1.3 due to out of sync version for derive package
- Fix: Failed attempts to rollback transactions during
Drop
of a connection will no longer panic.
- Fix:
Connection::execute_polling
did not enable asynchronus execution on the statement handle. This means that the operations on that cursor were actually blocking even if the driver does support polling.
- Fix release. Release from main branch
ConnectionAndError
now implementsstd::error::Error
.
- Fix: Fix version of
odbc-api-derive
crate
Connection::into_cursor
now allows you to recover theConnection
in case of failure. For this the return type has been changed fromError
toConnectionAndError
.Error
implementsFrom<ConnectionAndError>
, so converting it to Error via?
is frictionless.
- Improved documentation
- Update dependencies
- Fix: Add metadata for
odbc-api-derive
crate
- Fix: Release pipeline for derive feature
- Adds derive feature for deriving custom implementations of
FetchRow
.
- Adds support for row wise bulk fetching via
RowVec
.
- Removed
Quirks
. Detection of driver problems via dbms name is not relyable enough. - Support setting packet size, via
ConnectionOptions::packet_size
.
- Fixes an issue with
decimal_text_to_i128
, which caused a negative value to be treated as positive, if it had been below a magnitude of one. Thanks to @timkpaine for reporting and fixing the issue.
- Fixes an issue with
Environment::drivers
, which caused it to have at most one driver attribute in theDriverInfo
attributes.
ConcurrentBlockCursor::from_block_cursor
is now infalliable.Quirks::indicators_returned_from_bulk_fetch_are_memory_garbage
will be now set for every database name which starts withDB2
.
- Adds
ConcurrentBlockCursor
to ease fetching large result sets in a dedicated system thread.
- removed reexport of
force_send_sync
. It is no longer used withinodbc-api
this should have been removed together with the methods which were promoting Connections toSend
, but has been overlooked. - Adds
decimal_text_to_i128
a useful function for downstream applications includingodbc2parquet
andarrow-odbc
.
- Introducing
Quirks
to document knoweldege about behaviour from drivers which is different from the ODBC specification. This can be helpful for generic applications in order to support databases if they want to invest in workarounds for bugs or percularities of ODBC drivers.
- Additional
debug
log messages around allocating and deallocating handles.
ResultSetMetadata::col_display_size
now returnsOption<NonZeroUsize>
instead ofisize
.ResultSetMetadata::col_octet_length
now returnsOption<NonZeroUsize>
, instead ofisize
.ResultSetMetadata::utf8_display_sizes
now iterates overOption<NonZeroUsize>
, instead ofusize
.DataType
now stores the length of variadic types asOption<NonZeroUsize
> insteaf ofusize
.DataType::display_size
now returnsOption<NonZeroUSize>
instead ofOption<usize>
.DataType::utf8_len
now returnsOption<NonZeroUSize>
instead ofOption<usize>
.DataType::utf16_len
now returnsOption<NonZeroUSize>
instead ofOption<usize>
DataType::column_size
now returnsOption<NonZeroUSize>
instead ofusize
BufferDesc::from_data_type
now returnsNone
for variadic types without upper bound instead of a zero sized buffer.Indicator::value_len
now is namedIndicator::length
.- Provide buffer index for truncation errors
- Setting only
odbc_version_3_5
without deactivating default features now compiles again. It is still recommended though to use theodbc_version_3_5
flag only in combination with--no-default-features
sinceodbc_version_3_8
is a default feature.
ParameterDescription::nullable
has been renamed toParameterDescription::nullability
- Remove deprecated function
Connection::promote_to_send
. ErrorUnsupportedOdbcVersion
is now returned if driver manager emits a diagnostic record using with statusS1009
then setting ODBC version. That status code used to mean "Invalid Attribute" back in the days of ODBC 2.x.
- Adds
BlockCursor::row_array_size
, in order to infer maximum batch size without unbinding the row set buffer first. This allows downstreamarrow-odbc
for a faster implementation then creating a double buffered concurrent stream of batches directly from a block cursor.
It is now better possible to use odbc-api
with multithreading in completly safe code.
Connection
is nowSend
.StatementConnection
is nowSend
.
According to the standard this is guaranteed to be safe. By now this has also worked in practice long enough and with enough different drivers, that this can be considered safe, not only by the ODBC standard, but also in practice.
- Variant
Error::TooLargeValueForBuffer
now has a memberindicator
, indicating the size of the complete value in the DBMS. This has been introduced to help users decide how to pick a maximum string size in bulk fetches, in the presence of large variadic columns.
- Fix:
Cursor::fetch_with_truncation_check
did erroneously report truncation errors forNULL
fields, if the query also triggered any ODBC diagnostic. This has been fixed in the previous release for variadic binary column buffers but a similar failure had been missed for variadic text columns.
- Fix:
Cursor::fetch_with_truncation_check
did erroneously report truncation errors forNULL
fields, if the query also triggered any ODBC diagnostic. This remained undedected for a while, because in every situation that there is a truncation, there must also be a diagnostic according to the ODBC standard. However the reverse is not true. In this situation aNULL
had been erronously treated the same as aNO_TOTAL
indicator and a false positive has been reported to a user claiming that there is a truncation, there in fact is none.
- Introduced
CursorRow::get_wide_text
in order to fetch large UTF-16 values into a buffer. - The
IntoParameter
implementation forstr
slices andStrings
will now be converting them toVarWCharBox
if thenarrow
compile time feature is not activated. This has been done in order to allow for easier writing of portable code between Windows and non-Windows platforms. Usually you would like to activate thenarrow
feature on non-windows platform there a UTF-8 default locale can be assumed. On Windows you want utilize UTF-16 encoding since it is the only reliable way to to transfer non ASCII characters independent from the systems locale. With this change on both platforms one can now simply write:
// Uses UTF-16 if `narrow` is not set. Otherwise directly binds the UTF-8 silce.
conn.execute(&insert_sql, &"Frühstück".into_parameter()).unwrap();
// Guaranteed to use UTF-16 independent of compiliation flags.
let arg = U16String::from_str("Frühstück");
conn.execute(&insert_sql, &arg.into_parameter()).unwrap();
// Guaranteed to use UTF-8 independent of compiliation flags. This relies on the ODBC driver to use
// UTF-8 encoding.
let arg = Narrow("Frühstück");
conn.execute(&insert_sql, &arg.into_parameter()).unwrap();
- Corrected typos in documentation. Thanks to @zachbateman
- Support for
U16String
andOption<U16Str>
as input parameter viaIntoParameter
trait. - Added
VarWCharSlice
,VarWCharBox
,VarWCharSliceMut
,VarWCharArray
.
- Support
U16Str
andOption<U16Str>
as input parameter viaIntoParameter
trait.
- Fix:
Statement::complete_async
is now annotated to be only available in ODBC version 3.8. This missing annotation prevented compilation then specifying ODBC version 3.5.
CursorRow::get_variadic
is now private as it was always intended to be a private implemenatation detail.Statement::set_num_rows_fetched
has been split intoStatement::set_num_rows_fetched
andStatement::unset_num_rows_fetched
in order to reduce the amount of unsafe code a bit.- Adds
Cursor::more_results
to support statements which return multiple result sets.
-
Added support for login timeout, i.e. the user can now explicitly specify a time in seconds after which a login attempt to a datasource should fail. This triggered two breaking changes:
-
Environment::connect_with_connection_string
now takes an additional argumentConnectionOptions
. -
Environment::connect
now takes an additional argumentConnectionOptions
.
Migration is trivial, by supplying ConnectionsOptions::default()
as the last argument.
- Added catalog function
foreign_keys
toConnection
andPreallocated
.
CursorRow::get_text
orCursor::get_binary
now panics if theSQLGetData
implementation of the ODBC driver reports inconsistent indicator for the same cell. Previously it could have looped forever.
- Introduced common implementation
VarCell
forVarBinary
andVarChar
.
- Changed checking of truncated values after fetch. The new method checks the indicator buffer, rather than relying on diagnostics. This means
Error::TooManyDiagnostics
can no longer occurr.
- Better error messages if checking for truncation fails due to too many diagnostics
- Removed deprecated
BufferDescription
BufferKind
- Removed deprecated names
AnyColumnBuffer
AnyColumnSliceMut
AnyColumnView
RowSetCursor
RowSetCursorPolling
- Improved support for fetching parameter descriptions of prepared statements:
- Introduced method
Prepared::num_params
- Introduced method
Prepared::parameter_descriptions
- Introduced method
- Introduced method
Prepared::column_inserter
to replacePrepared::any_column_inserter
. - Introduced method
Prepared::into_column_inserter
to replacePrepared::into_any_column_inserter
.
- Introduced associated method
Item::buffer_desc
to replaceItem::BUFFER_KIND
.
BufferKind
andBufferDescription
are now unified toBufferDesc
.- Renamed
RowSetCursor
intoBlockCursor
. - Fix:
ColumnarBulkInserter::new
now resets all parameters on the statement handle in case it fails. This prevents accessing the bound parameters on a borrowed statement handle after the constructor failed, at which point their valididty is no longer guaranteed.
sys::Timestamp
is now directly supported withget_data
.InputParameter
is now implying the newCElement
trait.
- Removed
ColumnProjection
trait. ColumnBuffer
now has generic associated typeView
instead of inheriting fromColumnProjection
.WithDataType
can now also be used to annotate the Relational type onTimestamp
.WithDataType<Timestamp>
now implementsOutputParameter
.- Minimum Rust version is 1.65.0
- Fix: There has been an issue with fetching text values using
get_text
from adb2
System.db2
is not part of the test suite (yet?), so not entirely sure that it is truly gone yet, but chances are its fixed. - Implement
ColumnarBuffer
forVec<T>
.
TextBufferRowSet::for_cursor
now applies the upper bound column size limits also to buffers if the metadata indicates a size of0
. This allows e.g. fetching values from Microsoft SQL Server columns with typeVARCHAR(max)
.
- Updated documentation for
BufferDescription
andDataType
.
- Fetching diagnostic records now starts with a message buffer size of 512 instead of 0 in order to recduce calls to
SQLGetDiagRec
.
SqlResult
has now new variantsSqlResult::NoData
andSqlResult::NeedData
.SqlResult::into_result_with_trunaction_check
has been replaced bySqlResult::into_result_with
.handles::Environment::driver_connect
now returnsSqlResult<()>
instead ofSqlResult<bool>
.handles::Environment::drivers_buffer_fill
now returnsSqlResult<()>
instead ofSqlResult<bool>
.handles::Environment::drivers_buffer_len
now returnsSqlResult<(i16, i16)>
instead ofSqlResult<Option<(i16, i16)>>
.handles::Environment::data_source_buffer_len
now returnsSqlResult<(i16, i16)>
instead ofSqlResult<Option<(i16, i16)>>
.handles::Connection::execute
now returns now returnsSqlResult<()>
instead ofSqlResult<bool>
.handles::Connection::exec_direct
now returns now returnsSqlResult<()>
instead ofSqlResult<bool>
.handles::Statement::fetch
now returns now returnsSqlResult<()>
instead ofSqlResult<bool>
.handles::Statement::put_binary_batch
now returns now returnsSqlResult<()>
instead ofSqlResult<bool>
.
- Reserve an extra word (2 Bytes) when querying Catalog length in order to compensate for an of by one error in PostgreSQL driver when using wide character encoding. The issue would have resulted in the last letter being replaced with
\0
in previous versions.
- No breaking changes. Messed up setting version. Should have been
0.48.1
😅. - Asynchronous execution of one shot queries using
Connection::execute_polling
. - Asynchronous bulk fetching of results using
RowSetCursorPolling
.
- Both
Preallocated::row_count
andPrepared::row_count
now returnOption<usize>
instead ofisize
.
- Support getting number of rows affected by
INSERT
,UPDATE
orDELETE
.- New method
Preallocated::row_count
- New method
Prepared::row_count
- New method
TextRowSet::from_max_str_lens
now takesIntoIterator<Item=usize>
instead ofIterator<Item=usize>
.- trait method
RowSetBuffer::bind_to_cursor
has been renamed tobind_columns_to_cursor
and now takes aStatementRef
instead of aCursor
. This change is unlikely to affect user code, as so far I know all downstream crates use the providedRowSetBuffer
implementations and do not implement their own versions.
- Minimal support for asynchronous code in the
handle
module. SqlResult
has a new variantSqlResult::StillExecuting
.- New function
Statement::set_async_enable
can be used to enable polling for statements. - Functions returning
Option<SqlResult<_>>
now returnSqlResult<Option<_>>
orSqlResult<bool>
in order to allow for top level asynchronous code to build on the same abstraction as the synchronous code.
Since most users would not engage with the unsafe
functions of the handle
module their code should be unaffected.
TextRowSet::for_cursor
now only performs a faliable allocation, if no upper bound for string length is specified. This has been changed to remidy performance regressions, but still have the faliable allocation in situation there it could likely occurr.
- Add
Connection::into_prepared
to allow for prepared queries to take ownership of the connection. Prepared::describe_param
now requires an exclusive reference- Remove
Prebound
.
- Add
NullableSliceMut::set_cell
- Add
Bit::from_bool
.
- Add
ColumnarBulkInserter::capacity
.
- All methods on the
ResultSetMetaData
trait now require exclusive (&mut
) references. - The trait
BorrowMutStatement
has been replaced byAsStatementRef
. ColumnarBulkInserter
is now generic over statement ownership.- It is now possible to create a bulk inserter which just borrows a prepared statement, rather than taking ownership of it. Use
Prepared::any_column_inserter
to do so. This is useful for dynamically growing the capacity of the bound array parameters. So far users were forced to create a newColumnarBulkInserter
to do so. This is still true, but creating a newColumnarBulkInserter
now longer implies that a new prepared statement has to be created.
BoundInputSlice
,TextColumnSliceMut
andBinColumnSliceMut
now only track the lifetime of the statement. The do no longer need to track the lifetime of theConnection
anymore.
- Removed
TextColumn::set_max_len
asresize_max_str_len
can do everything the former can and does it better. ColumnBuffer
andTextRowSet
can no longer be used to insert data into the database. It can now only be used to receive data. This is due to different invariants which must hold true for input and output buffers. The newColumnarBulkInserter
which can be constructed usinginto_any_column_inserter
orinto_text_inserter
on a prepared statment closes this safety hole. It also allows for faster insertion into a database in case you transmit the data in several batches, because it does not require the user to rebind the parameter buffers in safe code. This significantly reduces the overhead for each batch.
- Refactored traits for passing parameters to
Connection::execute
. Should not break user syntax, though. - Allow using fixed size paramters like
i32
directly as output parameter without wrapping them into aNullable
first. - Renamed
TextColumnWriter::rebind
intoTextColumnWriter::resize_max_str
- Fast insertion into database using
TextRowSet
without rebinding parameter buffers for individual batches.
- Introduce alias for
ColumnarAnyBuffer
forColumnarBuffer<AnyColumnBuffer>
.
-
Introduce feature
iodbc
. This features enables all features required for this crate to work with the IODBC driver manager.narrow
ODBC function calls- Use of
odbc_version_3_5
symbols and declaration of ODBC API version 3.0. - Linking of upstream
odbc-sys
vsiodbc
as opposed to plainodbc
.
-
Introduce
ColumnDescription::new
to allow for intantiatingColumnDescription
in test cases without caring about wetherSqlChar
isu8
oru16
.
- The fallibale allocations introduced for
buffer_from_description
had performance implications. Therfore the fallibale allocations are available to users of this library totry_buffer_from_description
.buffer_for_description
is now panicing again in case there is not enough memory available to allocate the buffers.
- Fixed an issue introduced in
0.39.1
there the terminating zero at the end of diagnostic messages has not been removed correctly.
- Support for checking for truncation after bulk fetch with:
RowSetCursor::fetch_with_truncation_check
.
- Add column buffer index to allocation errors to provide more context
- Add fallibale allocation of binary columns.
- Add fallibale allocation of text columns.
- Add
AnyColumnViewMut::as_text_view
.
- If setting the ODBC version fails with
HY092
(Invalid attribute value), the user will now see an error message stating that likely the ODBC driver manager should be updated as it does not seem to support ODBC version 3.80. This gives the user a better starting point to fix the problem than just the diagnostic record.
- Introduce
AnyColumnView::Text
andAnyColumnView::WText
now holds aTextColumnView
instead of aTextColumnIt
. To get the iterator you can just calliter()
on theTextColumnView
. - Introduce
AnyColumnView::Binary
now holds aBinColumnView
instead of aBinColumnIt
. - Add
AnyColumnView::as_text_view
. - Add
AnyColumnView::as_w_text_view
. - Add
AnyColumnView::as_slice
. - Add
AnyColumnView::as_nullable_slice
.
The TextColumnView
has been added in order to allow for faster bindings to arrow. As it gives access to the raw value buffer.
- Allow direct access to raw buffers of
NullableSliceMut
.
- Allow direct access to raw buffers of
NullableSlice
. ColumnWithIndicator::iter
is no longerunsafe
TextColumn::indicator_at
is no longerunsafe
TextColumn::value_at
is no longerunsafe
BinColumn::value_at
is no longerunsafe
.BinColumn::iter
is no longerunsafe
.
Thanks to @jorgecarleitao for providing all the input about safety and discovering performance
bottlenecks in the buffer interfaces.
- Better error for Oracle users, then trying to fetch data into 64 Bit Buffers. Added variant
OracleOdbcDriverDoesNotSupport64Bit
to error type in order to achieve this.
- Introduce feature
odbc_version_3_5
. Decalaring ODBC version 3.80 is still default behaviour. The flag has mainly been introduced to achieve compatibility with iODBC.
- Introduces
narrow
feature, allowing to compile this library against narrow ODBC function calls. This is optional now, but may become default behaviour in the future on non-windows platforms (because those typically have UTF-8 locale by default.) - Removed public higher level methods directly dealing with utf16. Similar functions using unicode remain in the API. This has been done in order better support building against narrow ODBC function calls on some platforms while keeping complexity in check.
ResultSetMetadata::col_name
now returnsResult<String, Error>
.Environment::driver_connect
now takes&mut OutputStringBuffer
instead ofOption<&mut OutputStringBuffer>
. UseOutputStringBuffer::empty()
instead ofNone
.- Removed
Connection::tables
now takes&str
instead ofOption<&str>
arguments. Use""
instead of none - Removed
Environment::connect_utf16
. - Removed
Preallocated::execute_utf16
. - Removed
Connection::execute_utf16
. - Removed
Connection::prepare_utf16
. - Removed
OutputStringBuffer::ucstr
. - Removed
Connection::fetch_current_catalog
. - Removed
Connection::fetch_database_management_system_name
. - updated to
odbc-sys 0.21.2
- No changes (Release is currently tied to odbcsv)
- No changes (Release is currently tied to odbcsv)
- Uses Rust Edition 2021
- Mutable references
&mut T
are no longer implicitly bound as input / output Parameters, but must be wrapped withInOut
instead. This has been done to make the decision betweenOut
andInOut
explicit, and also help to avoid binding parameters asInOut
by accident. Shared references&T
are still implicitly bound as input parameters however. - Renamed
Parameter
toParameterRef
- Renamed
Parameter::bind_parameter
toParameterRef::bind_to
- Renamed
Output
toOutputParameter
- Renamed
TextColumn::rebind
toTextColumn::resize_max_str
. InputParameter
is now longer exported in the top level namespace, but only asparameter::InputParameter
.ParameterRefCollection::bind_to_statement
now takes&mut self
rather thanself
.ColumnarRowSet
andTextRowSetBuffer
are nowColumnarBuffer
, which is generic over columns.ColumnarRowSet::new
is nowbuffer_from_descriptions
.- Removed
SqlResult::log_diagnostics
.
- Removed
unsafe
from traitHasDataType
. - Introduced
Prepared::into_statement
andCursorImpl::new
to enable usecases not covered by safe abstractions yet.
escape_attribute_value
now also escapes+
signs. This has been introduced because an authentication vs a PostgreSQL failed, if a password containing+
has not been escaped.
- Fix: Some drivers (i.e. SqLite) report the size of column names in characters instead of bytes. This could cause truncation of names provided by
colum_names
if the supplied buffers were to short. Now the correct provided buffer is always resized to be large enough to hold the entire name, even for these drivers.
In order to avoid exposing the dependency to raw-window-handle
in the public interface the way this library opens prompts for connecetion on windows platform has changed:
- Breaking change:
Environment::driver_connect
now automatically creates a message only window for the user on non-windows platform.DriverCompleteOption
is now a simple C-Like enumeration. - Introduced
Environment::driver_connect_with_hwnd
to allow power users to provide their own window handles.
- Minor improvements to documentation.
- Allows for fetching result set metadata from
Prepared
statements.- Introduced trait
ResultSetMetadata
. Which is implemented by bothPrepared
andCursor
.
- Introduced trait
- Make
StatementConnection
public
- Add
into_cursor
to Connection
- Improved documentation for
Connection::columns
.
- Removed generic lifetime argument from
CursorImpl
. - Add
Connection::tables
. - Add
Preallocated::tables
.
- After failing to get any race conditions with it on either Windows or Linux.
Environment::new
is now considered to be safe.
- Reexport crate
force_send_sync
.
- Fix:
handles::Environment
is now longer declaredSync
. Due to the interior mutability regarding error states. - Fix: A lock has been added to
Environment
to ensure diagnostics for allocation errors always are handled by the correct thread.
- Add
is_empty
toNullableSlice
andNullableSliceMut
. - Remove
Statement::col_data_type
. Method is still available via theCursor
trait, though. - Replace
Error
withSqlReturn
inhandles
module to not make any decisions about handling diagnostics in that layer.
- Add implementation for
ExactSizeIterator
forTextColumnIt
andBinColumnIt
.
- Add
NullableSlice::len
.
- Fix:
DataType::Float
is now a struct variant holding a precision value which is either24
for 32Bit Floating points or53
for 64Bit Floating point numbers.
Connection::columns
andPreallocated::columns
now return aResult<CursorImpl, Error>
instead of aResult<Option<CursorImpl>, Error>
sincecolumns
always returns a Cursor.- These functions now return a
Result<u16, Error>
instead of aResult<usize, Error>
:Connection::max_catalog_name_len
Connection::max_schema_name_len
Connection::max_column_name_len
- Renamed
OptIt
toNullableSlice
. - Renamed
OptWriter
toNullableSliceMut
. - Added
buffer::Item
trait to make it more convinient to extract a slice or aNullableSlice
fromAnyColumnView
.
handles::Nullablility
now implementsCopy
.Nullable<T>
now implementsCopy
ifT
does.
- Add
Error::InvalidRowArraySize
which is returned instead ofError::Diagnostics
if invalid attribute is returned during setting row set array size.
Error::Diagnostics
is now a struct variant and also contains the name of the ODBC function call which caused the error.- Renamed
Error::OdbcApiVersionUnsupported
toUnsupportedOdbcApiVersion
to achieve consistent word order. - Fix: Row set array size is now specified in
usize
rather thanu32
. - Fix: Bind type is now specified in
usize
rather thanu32
. - Fix: Parameter set size is now specified in
usize
rather thanu32
.
- Fix: Code example blobs
- Fix: An issue intruduced in
0.24.0
there a searched update or delete statement that does not affect any rows at the data source could cause a panic.
- Add Support for sending long data.
- Add variant
DataType::LongVarChar
. - Add variant
DataType::LongVarBinary
. - Add variant
Error::FailedReadingInput
. - trait
HasDataType
no longer implies traitCData
.
- Adds
Connection::columns
- Adds
Connection::columns_buffer_description
These wrap the ODBC SqlColumns
function and represent anoter way to obtain schema information.
Thanks to @grovesNL for the contribution.
- Add support for Connection Pooling
- Add methods for exposing metadata to SQLColumns based queries (Thanks again to @grovesNL).
- Better error message in case ODBC Api version is set on older version of unixODBC.
- Introduced
OdbcApiVersionUnsupported
variant to Error type. - Changed ODBC state representation in diagnostic to narrow ASCII characters.
- Introduced
-
Fix:
VarCharBox::null()
had been bound asVARCHAR(0)
. This caused an error with Access and older versions of Microsoft SQL Server ODBC Driver. To fix thisVarCharBox::null()
is now bound asVARCHAR(1)
. Thanks to @grovesNL for finding and investigating the issue.Analoge issues also fixed for:
VarBinarySlice::NULL
VarBinaryBox::null()
- Fix:
VarCharSlice::NULL
had been bound asVARCHAR(0)
. This caused an error with Access and older versions of Microsoft SQL Server ODBC Driver. To fix thisVarCharSlice::NULL
is now bound asVARCHAR(1)
. Thanks to @grovesNL for finding and investigating the issue. - Support access to raw
odbc-sys
functionality. This is done to support use cases for which a safe abstraction is not yet available (like streaming large values into the database).- Add
preallocated::into_statement
. - Add
StatementImpl::into_sys
. - Add
StatementImpl::as_sys
. - Add
Statement::param_data
- Add
-
Support for passing binary data as parameter.
VarBinarySlice
- immutable borrowed parameter.VarBinarySliceMut
] - mutable borrowed input / output parameterVarBinaryArray
- stack allocated owned input / output parameterVarBinaryBox
- heap allocated owned input / output parameter&[u8]
now implementsIntoParameter
.Vec<u8>
now implementsIntoParameter
.
-
Introduced
CursorRow::get_binary
to fetch arbitrary large blobs into aVec<u8>
. -
Fix:
VarCharArray::new
is now placing a terminating zero at the end in case of truncation. As statet in the documentation.
- Add
Environment::driver_connect
which forwards more functionality fromSqlDriverConnect
. In particular it is now possible (on windows systems) to complete connection strings via the dialog provided by the ODBC driver and driver manager. Error
has new variant:Error::AbortedConnectionStringCompletion
. Which occurs if the GUI for completion is closed before returning any data.
Thanks to @grovesNL for the contribution.
Environment::drivers
now takes&self
instead of&mut self
.Environment::data_sources
now takes&self
instead of&mut self
.Environment::user_data_sources
now takes&self
instead of&mut self
.Environment::system_data_sources
now takes&self
instead of&mut self
.handles::Environment::drivers_buffer_len
now isunsafe
and takes&self
instead of&mut self
.handles::Environment::drivers_buffer_fill
now isunsafe
and takes&self
instead of&mut self
.handles::Environment::data_source_buffer_len
now isunsafe
and takes&self
instead of&mut self
.handles::Environment::data_source_buffer_fill
now isunsafe
and takes&self
instead of&mut self
.
Thanks to @grovesNL for the contribution.
- Test are now also executed against Maria DB
- Add
BufferDescription::bytes_per_row
. - Add function
escape_attribute_value
.
- Required at least Rust 1.51.0 to compile.
IntoParameter
has been implement forString
. This is the most likely thing to break your code as calling.into_parameter()
would have worked onString
before, but would have invoked the implementation onstr
. Should you want the old behaviour just callmy_string.as_str().into_parameter()
.- Replaced
VarCharRef
withVarCharSlice
. - Replaced
VarChar32
andVarChar512
withVarCharArray<LENGTH>
. - Replaced
VarCharMut
withVarCharSliceMut
. VarChar::copy_from_bytes
has been removed. Try constructing withnew
,from_buffer
or usingNULL
instead.VarChar::indicator()
now returns anIndicator
instead of anisize
.- Replaced
VarCharRef::null()
withVarCharSlice::NULL
. - Support
CString
andCStr
as input parameters.
Box<dyn InputParameter>
now implementsInputParameter
.
- Fix:
BinColumnWriter::append
erroneously inserted a terminating zero at the end of the value.
- Fix: Timestamps buffers are now bound with a default precision of 7 (100ns) in order to avoid an 'invalid precision' error than inserting (occurred with MSSQL). Previously the precision had been 9 (1ns).
Increased support for adaptive buffering during inserts using ColumnarRowSet
:
- Add
TextColumnWriter::append
. - Add
TextColumnWriter::max_len
. - Add
TextColumnWriter::rebind
. - Add
BinColumnWriter::max_len
. - Add
BinColumnWriter::rebind
. - Add
BinColumnWriter::append
.
Support for directly writing formatted text with fixed length to the underlying buffers.
- Add
TextColumn::set_mut
. - Add
TextColumnWriter::set_mut
.
- Add
TextColumnWriter::set_value
.
- Fix:
Statement::col_data_type
now returnsDataType::WChar
instead ofDataType::Other
then appropriate. - Fix: An out of bounds panic with columnar inserts from text buffer, if the last value of the buffer had maximum length in a buffer with the maximum number of rows filled (yes, off by one error).
- Add variant
DataType::WChar
for fixed sized UTF-16 character data. - Add method
DataType::utf16_len
.
CursorRow::get_text
now returnsbool
withfalse
indicating aNULL
field.TextColumn
is now generic over its character type. The type aliasCharColumn
forTextColumn<u8>
can serve as a drop in replacement for the previous iteration ofTextColumn
.AnyColumnBuffer
has a new variant calledWText
holding a UTF-16TextColumn<u16>
orWCharColumn
.TextRowSet::for_cursor
has a new parametermax_str_len
to designate the upper limit for column buffer size.- Add
TextRowSet::indicator_at
to allow checking for truncation of strings.
- Introduces
Cursor::next_row
to fetch data without binding buffers first. - Allow retrieving arbitrarily large strings from the data source.
- Removed
RowSetCursor::unbind
due to soundness issue, if fetching continues without any buffers bound. - Hides internal interface of
Cursor
trait behindCursor::stmt
. RowSetCursor
now implementsDrop
.Statement::set_num_rows_fetched
now takes an option to allow unbinding a previously set reference.- Trait
OutputParameter
has been renamed toOutput
. - Trait
FixedSizedCType
has been renamed toPod
.
Cursor::fetch
is now safe.- Introduced
Connection::preallocate
to allow for efficient preallocation of statement handles in interactive clients. - Renamed
Connection::exec_direct_utf16
intoConnection::execute_utf16
.
- Text column buffers throughout the API now use
&[u8]
to represent queried strings instead ofCStr
to account for the possibility of interior nuls.
- Fix:
BufferKind::from_data_type
now usesdisplay_size
rather thancolumn_size
then mappingNumeric
andDecimal
types toText
buffers. BufferKind::from_data_type
now mapsDataType::Time
withprecision
> 0 toBufferKind::Text
in order to avoid loosing fractional seconds.- Renamed
DataType::Tinyint
toDataType::TinyInt
in order to be consistent withDataType::SmallInt
. - Renamed
DataType::Bigint
toDataType::BigInt
in order to be consistent withDataType::SmallInt
. - Removed Application Row Descriptor handle. Likely to be reintroduced later though.
ColumnarRowSet
now has support for variadic binary data types.- Add support for binary data types.
- Add support for transactions.
- Add support for bulk inserts to
ColumnarRowSet
. - New section about inserting values in the guide.
- Add support for output parameters in stored procedures.
- Input parameters now must be bound by reference.
- Input/output parameters are bound by mutable reference.
Input
has been renamed toHasDataType
.Nullable
has been renamed toNullability
.- Update to odbc-sys 0.17.0.
- Add
ColumnarRowSet::with_column_indices
, to enable binding only some columns of a cursor object. - Struct
DataSourceInfo
is now public - Associated function of
Cursor
col_type
andcol_concise_type
have been removed in favor ofcol_data_type
. - Add
DataType::utf8_len
. - Fix:
TextRowSet::for_cursor
now allocates 4 times larger buffers for character data, in order to have enough space for larger utf-8 characters.
- Fix: There has been an integer overflow causing a panic if an ODBC API call generated more than 2 ^ 15 warnings at once.
- Fix:
BufferKind::from_data_type
now always uses the integer type which fits best, for Decimal and Numeric types with scale0
.
- Removed
Cursor::set_row_bind_type
. - Removed
Cursor::set_row_array_size
. - Removed
Cursor::set_num_rows_fetched
. RowSetBuffer
trait now requires an implementation ofbind_type
.RowSetBuffer
trait now requires an implementation ofrow_array_size
.RowSetBuffer
trait now requires an implementation ofmut_num_rows_fetched
.- Add
Environment::data_sources
. - Add
Environment::user_data_sources
. - Add
Environment::system_data_sources
. TextRowSet
now returnsCStr
instead of&[u8]
.
- Removed
Connection::promote_send_and_sync
because it is unclear that diagnostic messages would always be pulled by the correct thread. - Adds
Environment::drivers
to list available ODBC drivers.
- Implement
IntoParameter
forOption<&str>
.
Connection::execute
takes now&self
instead of&mut self
.- Support promoting
Connection
toSend
orSync
.
- Adds method
Prepared::describe_param()
. handle::Statement::bind_parameter
changes intohandle::Statement::bind_input_parameter
, in order take a* const
.VarCharParam
renamed intoVarChar
.TextRowSet::new
renamed intoTextRowSet::for_cursor
.- trait
ParameterCollection
has a new methodparameter_set_size
. Parameter
trait is now inheriting fromInput
.ColumnBuffer
trait is replaced byCDataMut
.- Extended guide with section about parameter binding.
Environment
is nowSend
andSync
.- Fix: Executing statements not generating results now does no longer create cursors.
- Fix:
Prepared::execute
now returnsResult<Option<CursorImpl<_>>, Error>
instead ofResult<CursorImpl<_>, Error>
. - Fix:
Cursor::execute
is nowunsafe
. - Fix:
Cursor::fetch
is nowunsafe
.
Cursor::bind_row_set_buffer
is nowCursor::bind_buffer
.Connection::exec_direct
is nowConnection::execute
.- Tuple support for passing input parameters.
- Basic support for binding parameters.
- Basic support for prepared queries.
- Due to the new possibility of binding parameters
Statement::exec_direct
andStatement::execute
must now be considered unsafe. BindColParameters
renamed toBindColArgs
.
Environment::connect
now takes&str
instead of&U16Str
.- Adds
Environment::connect_utf16
.
- Logs all diagnostics in case driver returns multiple errors.
- Adds
Bit
,OptBitColumn
,OptI8Column
,OptU8Column
.
- Extend
ColumnDescription
enum withBigint
,Tinyint
andBit
.
- Introduced
DataType
into theColumnDescription
struct. - Renaming: Drops
Buffer
suffix fromOptDateColumn
,OptF32Column
,OptF64Column
,OptFixedSizedColumn
,OptI32Column
,OptI64Column
,OptTimestampColumn
.
- Adds buffer implementation for fixed sized types
- Implements
FixedCSizedCType
forodbc_sys::Time
.
- Renamed
cursor::col_data_type
tocursor::col_type
. - Adds
cursor::col_concise_type
.
- Adds
cursor::col_precision
. - Adds
cursor::col_scale
. - Adds
cursor::col_name
.
- Add trait
buffers::FixSizedCType
.
- Fix:
buffers::TextColumn
now correctly adjusts the target length by +1 for terminating zero.
Adds buffers::TextRowSet
.
- Adds
col_display_size
,col_data_type
andcol_octet_length
toCursor
.
- Adds convenience methods, which take UTF-8 in public interface.
- Adds
ColumnDescription::could_be_null
. - Adds
Cursor::is_unsigned
.
Initial release