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
//! `oxisql-sqlite-compat` — Pure-Rust SQLite-compatible backend for OxiSQL.
//!
//! Wraps [oxisqlite](https://github.com/cool-japan/oxisql) — a C-free fork of
//! [Limbo](https://github.com/tursodatabase/limbo) 0.0.22 with all C/C++
//! dependencies stripped — and implements [`Connection`] so that any OxiSQL
//! consumer can use SQLite without linking `libsqlite3` or any C/C++ dependency.
//!
//! # Quick start
//!
//! ```rust,no_run
//! # #[tokio::main]
//! # async fn main() -> Result<(), oxisql_core::OxiSqlError> {
//! use oxisql_sqlite_compat::SqliteConnection;
//! use oxisql_core::Connection;
//!
//! // In-memory database (destroyed when the connection is dropped).
//! let conn = SqliteConnection::open_memory().await?;
//!
//! conn.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)", &[]).await?;
//! conn.execute("INSERT INTO users VALUES ($1, $2)", &[&1i64, &"Alice"]).await?;
//!
//! let rows = conn.query("SELECT id, name FROM users", &[]).await?;
//! assert_eq!(rows.len(), 1);
//! # Ok(())
//! # }
//! ```
//!
//! # File-backed database
//!
//! ```rust,no_run
//! # #[tokio::main]
//! # async fn main() -> Result<(), oxisql_core::OxiSqlError> {
//! use oxisql_sqlite_compat::SqliteConnection;
//!
//! # let path = std::env::temp_dir().join("mydb.sqlite3");
//! let conn = SqliteConnection::open(path.to_str().unwrap()).await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Limbo version caveats (0.0.22)
//!
//! - **Affected-row count**: Limbo's `execute()` returns a status code, not an
//! affected-row count. This crate issues `SELECT changes()` after each DML
//! to retrieve the count, which adds one round-trip per write operation.
//! - **Positional parameters**: Limbo only supports `?` placeholders. OxiSQL
//! uses `$1`, `$2`, … — this crate performs a quote-aware rewrite before each
//! statement is prepared.
//! - **Named parameters**: Not supported (upstream limbo 0.0.22 limitation).
//! Calling code should use positional parameters only.
//! - **Prepared-statement caching**: limbo 0.0.22 / oxisqlite does not cache
//! compiled bytecode. The [`PreparedStatement`] wrapper re-prepares on every call.
//! - **Savepoints**: Not supported. Calling `savepoint` / `rollback_to_savepoint`
//! / `release_savepoint` returns `OxiSqlError::Other`.
//!
//! [`Connection`]: oxisql_core::Connection
//! [`PreparedStatement`]: oxisql_core::PreparedStatement
pub use ;
pub use SqliteConnection;
pub use SqliteCompatError;