1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! ODBC driver for SQLx.
//!
//! `sqlx-odbc` connects SQLx to databases exposed through an ODBC driver
//! manager. Use it directly with `sqlx-core` native APIs, or install its
//! [`Any` driver][any::DRIVER] when an application wants to open ODBC connection
//! strings through `AnyConnection`.
//!
//! # Native connection
//!
//! ```no_run
//! use sqlx_core::connection::Connection;
//! use sqlx_core::row::Row;
//! use sqlx_odbc::OdbcConnection;
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let mut conn = OdbcConnection::connect("Driver=DuckDB;Database=/tmp/example.duckdb").await?;
//!
//! let row = sqlx_core::query::query("SELECT 1")
//! .fetch_one(&mut conn)
//! .await?;
//!
//! let value: i32 = row.try_get(0)?;
//! assert_eq!(value, 1);
//!
//! conn.close().await?;
//! # Ok(())
//! # }
//! ```
//!
//! `OdbcConnection::connect()` accepts a standard ODBC connection string, a bare
//! DSN name, or the legacy `odbc:` prefix.
//!
//! # `AnyConnection`
//!
//! Install this driver before connecting through SQLx `Any` APIs:
//!
//! ```no_run
//! use sqlx_core::connection::Connection;
//!
//! # async fn run() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! sqlx_core::any::driver::install_drivers(&[sqlx_odbc::any::DRIVER])?;
//!
//! let mut conn = sqlx_core::any::AnyConnection::connect(
//! "odbc:Driver=DuckDB;Database=/tmp/example.duckdb",
//! )
//! .await?;
//!
//! conn.close().await?;
//! # Ok(())
//! # }
//! ```
//!
//! To combine split drivers, install all of them once at application startup:
//!
//! ```ignore
//! fn install() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! sqlx_core::any::driver::install_drivers(&[
//! sqlx_sqlserver::any::DRIVER,
//! sqlx_odbc::any::DRIVER,
//! ])?;
//! Ok(())
//! }
//! ```
//!
//! # Native ODBC requirements
//!
//! On Linux and macOS, install a driver manager such as unixODBC plus a
//! database-specific ODBC driver. On Windows, the driver manager is built in,
//! but the database-specific driver is still required. DSNs can be configured in
//! the driver manager, or callers can pass a full `Driver=...;...` connection
//! string.
//!
//! Enable the `vendored-unix-odbc` feature to statically link the unixODBC
//! driver manager into your application on Linux or macOS. The actual database
//! ODBC driver still needs to be installed and discoverable at runtime.
//!
//! Buffered fetching can improve throughput, but long text or binary values may
//! be truncated when `max_column_size` is set. Use unbuffered mode for values
//! that may exceed that limit.
pub use ;
pub use OdbcColumn;
pub use OdbcConnection;
pub use Odbc;
pub use ;
pub use ;
pub use OdbcQueryResult;
pub use OdbcRow;
pub use OdbcStatement;
pub use OdbcTransactionManager;
pub use ;
pub use ;
/// An alias for [`Pool`][sqlx_core::pool::Pool], specialized for ODBC.
pub type OdbcPool = Pool;
/// An alias for [`PoolOptions`][sqlx_core::pool::PoolOptions], specialized for ODBC.
pub type OdbcPoolOptions = PoolOptions;
/// An alias for [`Transaction`][sqlx_core::transaction::Transaction], specialized for ODBC.
pub type OdbcTransaction<'c> = Transaction;
/// An alias for [`Executor<'_, Database = Odbc>`][sqlx_core::executor::Executor].