Expand description
Provides basic abstraction over valid (i.e. allocated ODBC handles).
Two decisions are already baked into this module:
- Treat warnings by logging them with
log
. - Use the Unicode (wide) variants of the ODBC API.
Structs§
- Column
Description - Describes the type and attributes of a column.
- Connection
- The connection handle references storage of all information about the connection to the data source, including status, transaction state, and error information.
- Descriptor
- A descriptor associated with a statement. This wrapper does not wrap explicitly allocated descriptors which have the connection as parent, but usually implicitly allocated ones associated with the statement. It could also represent an explicitly allocated one, but ony in the context there it is associated with a statement and currently borrowed from it.
- Environment
- An
Environment
is a global context, in which to access data. - Output
String Buffer - We use this as an output buffer for strings. Allows for detecting truncation.
- Parameter
Description - Description of a parameter associated with a parameter marker in a prepared statement. Returned
by
crate::Prepared::describe_param
. - Record
- ODBC Diagnostic Record
- SqlText
- Handles conversion from UTF-8 string slices to ODBC SQL char encoding. Depending on the conditional compiliation due to feature flags, the UTF-8 strings are either passed without conversion to narrow method calls, or they are converted to UTF-16, before passed to the wide methods.
- State
- A buffer large enough to hold an
SOLState
for diagnostics - Statement
Impl - An owned valid (i.e. successfully allocated) ODBC statement handle.
- Statement
Ref - A borrowed valid (i.e. successfully allocated) ODBC statement handle. This can be used instead
of a mutable reference to a
StatementImpl
. The main advantage here is that the lifetime paramater remains covariant, whereas if we would just take a mutable reference to an owned statement it would become invariant. - SzBuffer
- Use this buffer type to fetch zero terminated strings from the ODBC API. Either allocates a buffer for wide or narrow strings dependend on the features set.
Enums§
- Data
Type - The relational type of the column. Think of it as the type used in the
CREATE TABLE
statement then creating the database. - Nullability
- Indication of whether a column is nullable or not.
- SqlResult
- Result of an ODBC function call. Variants hold the same meaning as the constants associated with
SqlReturn
. This type may hold results, but it is still the responsibility of the user to fetch and handle the diagnostics in case of an Error.
Traits§
- AsHandle
- Provides access to the raw underlying ODBC handle.
- AsStatement
Ref - Allows us to be generic over the ownership type (mutably borrowed or owned) of a statement
- CData
- Provides description of C type layout and pointers to it. Used to bind and buffers to ODBC statements.
- CData
Mut - A type which can be bound mutably to ODBC.
- Delayed
Input - Stream which can be bound as in input parameter to a statement in order to provide the actual data at statement execution time, rather than preallocated buffers.
- Diagnostics
- Report diagnostics from the last call to an ODBC function using a handle.
- HasData
Type - Can be bound to a single placeholder in an SQL statement.
- Statement
- An ODBC statement handle. In this crate it is implemented by
self::StatementImpl
. In ODBC Statements are used to execute statements and retrieve results. Both parameter and result buffers are bound to the statement and dereferenced during statement execution and fetching results.
Functions§
- drop_
handle ⚠ - Helper function freeing a handle and panicking on errors. Yet if the drop is triggered during another panic, the function will simply ignore errors from failed drops.
- log_
diagnostics - This function inspects all the diagnostics of an ODBC handle and logs their text messages. It is going to print placeholder characters, if it cannot convert the message to UTF-8.
- slice_
to_ cow_ utf8 - slice_
to_ utf8