Crate odbc_api

Source
Expand description

§About

odbc-api enables you to write applications which utilize ODBC (Open Database Connectivity) standard to access databases. See the guide for more information and code examples.

Re-exports§

pub use self::handles::ColumnDescription;
pub use self::handles::DataType;
pub use self::handles::Nullability;
pub use self::parameter::InOut;
pub use self::parameter::Out;
pub use self::parameter::OutputParameter;
pub use odbc_sys as sys;

Modules§

buffers
Using buffers to fetch results
guide
Introduction to odbc-api (documentation only)
handles
Provides basic abstraction over valid (i.e. allocated ODBC handles).
parameter
Passing parameters to statement

Structs§

Bit
New type wrapping u8 and binding as SQL_BIT.
BlockCursor
In order to save on network overhead, it is recommended to use block cursors instead of fetching values individually. This can greatly reduce the time applications need to fetch data. You can create a block cursor by binding preallocated memory to a cursor using Cursor::bind_buffer. A block cursor saves on a lot of IO overhead by fetching an entire set of rows (called rowset) at once into the buffer bound to it. Reusing the same buffer for each rowset also saves on allocations. A challange with using block cursors might be database schemas with columns there individual fields can be very large. In these cases developers can choose to:
BlockCursorPolling
Asynchronously iterates in blocks (called row sets) over a result set, filling a buffers with a lot of rows at once, instead of iterating the result set row by row. This is usually much faster. Asynchronous sibiling of self::BlockCursor.
ColumnarBulkInserter
Can be used to execute a statement with bulk array paramters. Contrary to its name any statement with parameters can be executed, not only INSERT however inserting large amounts of data in batches is the primary intended use case.
ConcurrentBlockCursor
A wrapper around block cursors which fetches data in a dedicated system thread. Intended to fetch data batch by batch while the application processes the batch last fetched. Works best with a double buffer strategy using two fetch buffers.
Connection
The connection handle references storage of all information about the connection to the data source, including status, transaction state, and error information.
ConnectionOptions
Options to be passed then opening a connection to a datasource.
CursorImpl
Cursors are used to process and iterate the result sets returned by executing queries. Created by either a prepared query or direct execution. Usually utilized through the crate::Cursor trait.
CursorPolling
The asynchronous sibiling of CursorImpl. Use this to fetch results in asynchronous code.
CursorRow
An individual row of an result set. See crate::Cursor::next_row.
DataSourceInfo
Holds name and description of a datasource
DriverInfo
Struct holding information available on a driver. Can be obtained via Environment::drivers.
Environment
An ODBC 3.8 environment.
Narrow
Newtype wrapper intend to be used around Strings or str slices to bind them always as narrow text independent of wether the narrow feature is set or not.
Nullable
Wraps a type T together with an additional indicator. This way the type gains a Null representation, those memory layout is compatible with ODBC.
Preallocated
A preallocated SQL statement handle intended for sequential execution of different queries. See crate::Connection::preallocate.
PreallocatedPolling
Asynchronous sibling of Preallocated using polling mode for execution. Can be obtained using Preallocated::into_polling.
Prepared
A prepared query. Prepared queries are useful if the similar queries should executed more than once. See crate::Connection::prepare.
StatementConnection
Statement handle which also takes ownership of Connection
TooLargeBufferSize
Error indicating a failed allocation for a column buffer
TruncationInfo
Returned by RowSetBuffer::find_truncation. Contains information about the truncation found.
U16Str
16-bit wide string slice with undefined encoding.
U16String
An owned, mutable 16-bit wide string with undefined encoding.

Enums§

DriverCompleteOption
Specifies how the driver and driver manager complete the incoming connection string. See crate::Environment::driver_connect.
Error
Error type used to indicate a low level ODBC call returned with SQL_ERROR.

Traits§

BoundInputSlice
You can obtain a mutable slice of a column buffer which allows you to change its contents.
Cursor
Cursors are used to process and iterate the result sets returned by executing queries.
IntoParameter
An instance can be consumed and to create a parameter which can be bound to a statement during execution.
ParameterCollection
Implementers of this trait can be bound to a statement through a self::ParameterCollectionRef.
ParameterCollectionRef
SQL Parameters used to execute a query.
ParameterTupleElement
Implementers of this trait can be used as individual parameters of in a tuple of parameter references. This includes input parameters, output or in/out parameters.
ResultSetMetadata
Provides Metadata of the resulting the result set. Implemented by Cursor types and prepared queries. Fetching metadata from a prepared query might be expensive (driver dependent), so your application should fetch the Metadata it requires from the Cursor if possible.
RowSetBuffer
A Row set buffer binds row, or column wise buffers to a cursor in order to fill them with row sets with each call to fetch.
Sleep
Governs the behaviour of of polling in async functions.

Functions§

decimal_text_to_i128
Convert the text representation of a decimal into an integer representation. The integer representation is not truncating the fraction, but is instead the value of the decimal times 10 to the power of scale. E.g. 123.45 of a Decimal with scale 3 is thought of as 123.450 and represented as 123450. This method will regard any non digit character as a radix character with the exception of a + or - at the beginning of the string.
environment
An ODBC Environment with static lifetime. This function always returns a reference to the same instance. The environment is constructed then the function is called for the first time. Every time after the initial construction this function must succeed.
escape_attribute_value
You can use this method to escape a password so it is suitable to be appended to an ODBC connection string as the value for the PWD attribute. This method is only of interest for application in need to create their own connection strings.