Module odbc

Module odbc 

Source
Available on crate feature odbc only.
Expand description

ODBC database driver (via odbc-api).

§Connection Strings

When using the Any connection type, SQLx accepts standard ODBC connection strings:

// DSN-based connection
DSN=MyDataSource;UID=myuser;PWD=mypassword

// Driver-based connection
Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=test

// File DSN
FILEDSN=/path/to/myfile.dsn

The odbc: URL scheme prefix is optional but still supported for backward compatibility:

odbc:DSN=MyDataSource

§Buffer Configuration

You can configure buffer settings for performance tuning:

use std::str::FromStr;
use sqlx_core_oldapi::odbc::{OdbcConnectOptions, OdbcBufferSettings};

let mut opts = OdbcConnectOptions::from_str("DSN=MyDataSource")?;

// Configure for high-throughput buffered mode
opts.buffer_settings(OdbcBufferSettings {
    batch_size: 256,           // Fetch 256 rows at once
    max_column_size: Some(2048), // Limit text columns to 2048 chars
});

// Configure for unbuffered mode (no truncation, row-by-row processing)
opts.buffer_settings(OdbcBufferSettings {
    batch_size: 128,           // batch_size ignored in unbuffered mode
    max_column_size: None,     // Enable unbuffered mode
});

// Or configure individual settings
opts.batch_size(512)
    .max_column_size(Some(1024));

// Switch to unbuffered mode
opts.max_column_size(None);

Modules§

statement
types

Structs§

ColumnData
Container for column data with type information
Odbc
OdbcArguments
OdbcBatch
OdbcBufferSettings
Configuration for ODBC buffer settings that control memory usage and performance characteristics.
OdbcColumn
OdbcConnectOptions
OdbcConnection
A connection to an ODBC-accessible database.
OdbcQueryResult
OdbcRow
OdbcStatement
OdbcStatementMetadata
OdbcTransactionManager
OdbcTypeInfo
Type information for an ODBC type.
OdbcValue
OdbcValueRef

Enums§

OdbcArgumentValue
OdbcValueType
Individual ODBC value type
OdbcValueVec
Enum containing owned column data for all supported ODBC types

Traits§

DataTypeExt
Extension trait for DataType with helper methods
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.