odbc_api

Module handles

Source
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§

  • Describes the type and attributes of a column.
  • The connection handle references storage of all information about the connection to the data source, including status, transaction state, and error information.
  • 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.
  • An Environment is a global context, in which to access data.
  • We use this as an output buffer for strings. Allows for detecting truncation.
  • Description of a parameter associated with a parameter marker in a prepared statement. Returned by crate::Prepared::describe_param.
  • ODBC Diagnostic Record
  • 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.
  • A buffer large enough to hold an SOLState for diagnostics
  • An owned valid (i.e. successfully allocated) ODBC statement handle.
  • 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.
  • 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§

  • The relational type of the column. Think of it as the type used in the CREATE TABLE statement then creating the database.
  • Indication of whether a column is nullable or not.
  • 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§

  • Provides access to the raw underlying ODBC handle.
  • Allows us to be generic over the ownership type (mutably borrowed or owned) of a statement
  • Provides description of C type layout and pointers to it. Used to bind and buffers to ODBC statements.
  • A type which can be bound mutably to ODBC.
  • 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.
  • Report diagnostics from the last call to an ODBC function using a handle.
  • Can be bound to a single placeholder in an SQL 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§

  • 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.
  • 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.

Type Aliases§