Skip to main content

Crate sqlx_odbc

Crate sqlx_odbc 

Source
Expand description

ODBC database driver building blocks for SQLx.

This crate is being ported as an independent split driver crate. It intentionally depends on published crates from crates.io only; it does not depend on a local SQLx checkout.

§Test Setup

Fast tests do not require an ODBC data source:

cargo test

Integration smoke tests use ODBC_DATABASE_URL and skip cleanly when it is absent:

ODBC_DATABASE_URL='DSN=MyDataSource;UID=user;PWD=password' cargo test --test odbc

To run the same tests locally against a known installed driver:

scripts/test-driver.sh duckdb
DUCKDB_ODBC_DRIVER=/absolute/path/to/libduckdb_odbc.so scripts/test-driver.sh duckdb
ODBC_DATABASE_URL='DSN=MyDataSource;UID=user;PWD=password' scripts/test-driver.sh custom

ODBC_DATABASE_URL may be a standard ODBC connection string, a bare DSN name, or the legacy odbc: form:

DSN=MyDataSource
Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=test
FILEDSN=/path/to/file.dsn
odbc:DSN=MyDataSource
MyDataSource

Native requirements are provided by the operating system:

  • Unix-like systems need an ODBC driver manager such as unixODBC.
  • A database-specific ODBC driver must be installed and visible to the driver manager.
  • DSN names must be configured in the driver manager’s usual files or registry locations.
  • Buffered fetching can truncate long text or binary values when max_column_size is set.
  • Enable the vendored-unix-odbc feature to statically link the unixODBC driver manager.

Modules§

any
Runtime Any driver support for ODBC.

Structs§

Odbc
ODBC database marker for SQLx-core traits.
OdbcArguments
Argument buffer for ODBC queries.
OdbcBufferSettings
Fetch-buffer settings used by the ODBC driver.
OdbcColumn
Column metadata for an ODBC row or statement.
OdbcConnectOptions
Connection options for an ODBC data source.
OdbcConnection
Blocking ODBC connection wrapper.
OdbcDatabaseError
Database error details extracted from ODBC diagnostics.
OdbcParameterCollection
Owned ODBC parameter storage ready to bind with odbc-api.
OdbcQueryResult
Result summary for an ODBC query.
OdbcRow
Minimal ODBC row container used by the SQLx-core skeleton.
OdbcStatement
Prepared statement metadata for ODBC.
OdbcTransactionManager
Transaction manager placeholder for ODBC.
OdbcTypeInfo
Type information for an ODBC value.
OdbcValue
A small owned ODBC value representation used by unit tests and Any-mapping work.

Enums§

OdbcArgumentValue
Values that can currently be bound to ODBC parameters.
OdbcError
Error type returned by this crate while the SQLx driver port is in progress.
OdbcValueKind
Supported owned ODBC value kinds.

Traits§

DataTypeExt
Helper predicates for odbc-api data type groups.
OdbcExecutor
An alias for Executor<'_, Database = Odbc>.

Type Aliases§

OdbcPool
An alias for Pool, specialized for ODBC.
OdbcPoolOptions
An alias for PoolOptions, specialized for ODBC.
OdbcTransaction
An alias for Transaction, specialized for ODBC.
Result
Result alias for this crate.