NativeOdbcConnection class

Native ODBC connection implementation using FFI bindings.

Provides direct access to the Rust-based ODBC engine through FFI. This is the low-level implementation that handles all native ODBC operations including connections, queries, transactions, prepared statements, connection pooling, and streaming.

Example:

final native = NativeOdbcConnection();
native.initialize();
final connId = native.connect('DSN=MyDatabase');
Implemented types

Constructors

NativeOdbcConnection()
Creates a new NativeOdbcConnection instance.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isInitialized → bool
Whether the ODBC environment has been initialized.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

beginTransaction(int connectionId, int isolationLevel) → int
Begins a new transaction with the specified isolation level.
beginTransactionHandle(int connectionId, int isolationLevel) → TransactionHandle?
Begins a new transaction and returns a TransactionHandle wrapper.
bulkInsertArray(int connectionId, String table, List<String> columns, Uint8List dataBuffer, int rowCount) → int
Performs a bulk insert operation.
catalogColumns(int connectionId, String table) → Uint8List?
Queries the database catalog for column information.
override
catalogQuery(int connectionId) → CatalogQuery
Creates a CatalogQuery wrapper for database catalog queries.
catalogTables(int connectionId, {String catalog = '', String schema = ''}) → Uint8List?
Queries the database catalog for table information.
override
catalogTypeInfo(int connectionId) → Uint8List?
Queries the database catalog for data type information.
override
closeStatement(int stmtId) → bool
Closes and releases a prepared statement.
override
commitTransaction(int txnId) → bool
Commits a transaction.
override
connect(String connectionString) → int
Establishes a new database connection.
connectWithTimeout(String connectionString, int timeoutMs) → int
Establishes a connection with a login timeout.
createConnectionPool(String connectionString, int maxSize) → ConnectionPool?
Creates a new connection pool and returns a ConnectionPool wrapper.
createSavepoint(int txnId, String name) → bool
Creates a savepoint within an active transaction.
override
disconnect(int connectionId) → bool
Closes and disconnects a connection.
dispose() → void
Disposes of native resources.
executePrepared(int stmtId, [List<ParamValue>? params]) → Uint8List?
Executes a prepared statement with optional parameters.
override
executePreparedRaw(int stmtId, Uint8List? serializedParams) → Uint8List?
Executes a prepared statement with params already serialized (bytes).
executeQueryMulti(int connectionId, String sql, {int? maxBufferBytes}) → Uint8List?
Executes a SQL query that returns multiple result sets.
executeQueryParams(int connectionId, String sql, List<ParamValue> params, {int? maxBufferBytes}) → Uint8List?
Executes a SQL query with parameters.
executeQueryParamsRaw(int connectionId, String sql, Uint8List? serializedParams, {int? maxBufferBytes}) → Uint8List?
Executes a parameterized query with params already serialized (bytes).
getError() → String
Gets the last error message from the native engine.
getMetrics() → OdbcMetrics?
Gets performance and operational metrics.
getStructuredError() → StructuredError?
Gets structured error information including SQLSTATE and native code.
initialize() → bool
Initializes the ODBC environment.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
poolClose(int poolId) → bool
Closes the connection pool and releases all connections.
override
poolCreate(String connectionString, int maxSize) → int
Creates a new connection pool.
poolGetConnection(int poolId) → int
Gets a connection from the pool.
override
poolGetState(int poolId) → ({int idle, int size})?
Gets the current state of the connection pool.
override
poolHealthCheck(int poolId) → bool
Performs a health check on the connection pool.
override
poolReleaseConnection(int connectionId) → bool
Releases a connection back to the pool.
override
prepare(int connectionId, String sql, {int timeoutMs = 0}) → int
Prepares a SQL statement for execution.
prepareStatement(int connectionId, String sql, {int timeoutMs = 0}) → PreparedStatement?
Prepares a SQL statement and returns a PreparedStatement wrapper.
releaseSavepoint(int txnId, String name) → bool
Releases a savepoint. The transaction remains active.
override
rollbackToSavepoint(int txnId, String name) → bool
Rolls back to a savepoint. The transaction remains active.
override
rollbackTransaction(int txnId) → bool
Rolls back a transaction.
override
streamQuery(int connectionId, String sql, {int chunkSize = 1000}) → Stream<ParsedRowBuffer>
Executes a SQL query and returns results as a stream.
streamQueryBatched(int connectionId, String sql, {int fetchSize = 1000, int chunkSize = 64 * 1024}) → Stream<ParsedRowBuffer>
Executes a SQL query and returns results as a batched stream.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited