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
//! `oxisql-postgres` — Pure-Rust PostgreSQL backend for OxiSQL.
//!
//! Provides [`PgConnection`], which implements [`oxisql_core::Connection`]
//! over `tokio-postgres` (no `libpq`, no C bindings) with TLS support via
//! `rustls` + `rustls-rustcrypto` (no `ring`, no `openssl-sys`).
//!
//! # Wire protocol compliance
//!
//! This crate uses the PostgreSQL **Frontend/Backend Protocol version 3**
//! (introduced in PostgreSQL 7.4) as implemented by `tokio-postgres`. All
//! client–server communication is framed according to that specification:
//!
//! | API path | Wire mode |
//! |-----------------------------------|---------------------------------------|
//! | `execute` / `query` | Extended-query protocol (`Parse` → `Bind` → `Execute` → `Sync`) |
//! | `execute_batch` / `begin_txn` | Simple-query protocol (`Query` message) |
//! | `query_binary` | Extended-query with explicit type OIDs; results decoded in **binary format** (format code 1) |
//! | `prepare` / `describe` | Extended-query `Parse` + `Describe` only (no `Execute`) |
//! | `pipeline` | Multiple extended-query cycles flushed as a single send buffer |
//!
//! ## Limitations
//!
//! * **Logical replication** (Streaming Replication Protocol) is not supported.
//! * **Cancellation** via the `CancelRequest` flow is available through
//! [`PgConnection::cancel_token`] → [`PostgresCancelToken::cancel_query`].
//! It is not exposed at the `Connection` trait level; individual queries can
//! also be cancelled by dropping the `Future`.
//! * Notification delivery via `LISTEN` is only available on connections
//! created through [`PgConnection::connect`] (not `from_client`), because
//! the background `Connection` driver that routes `NotificationResponse`
//! messages is only spawned in that code path.
//! * PostgreSQL protocol v2 (pre-7.4) servers are not supported.
//!
//! # Quick start (no TLS)
//!
//! ```rust,no_run
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use oxisql_postgres::{PgConnection, TlsMode};
//! use oxisql_core::Connection;
//!
//! let conn = PgConnection::connect(
//! "host=localhost port=5432 user=postgres password=secret",
//! TlsMode::Disabled,
//! ).await?;
//!
//! conn.execute("CREATE TABLE IF NOT EXISTS t (id BIGINT)", &[]).await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Quick start (TLS via OxiTLS)
//!
//! ```rust,no_run
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use oxisql_postgres::{PgConnection, TlsMode};
//!
//! // Build a ClientConfig trusting the Mozilla CA bundle.
//! // Requires the "pure" + "webpki-roots" features of oxitls (the defaults).
//! let root_store = oxitls::webpki_root_certs();
//! let client_cfg = oxitls::client_config(root_store)
//! .map_err(|e| format!("TLS cfg: {e}"))?;
//!
//! let conn = PgConnection::connect(
//! "host=db.example.com port=5432 user=postgres sslmode=require",
//! TlsMode::Rustls(client_cfg),
//! ).await?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use PgError;
pub use ;
pub use ;
pub use PgPrepared;
pub use ;