Expand description
oxisql-sqlite-compat — Pure-Rust SQLite-compatible backend for OxiSQL.
Wraps oxisqlite — a C-free fork of
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
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);§File-backed database
use oxisql_sqlite_compat::SqliteConnection;
let conn = SqliteConnection::open(path.to_str().unwrap()).await?;§Limbo version caveats (0.0.22)
- Affected-row count: Limbo’s
execute()returns a status code, not an affected-row count. This crate issuesSELECT 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
PreparedStatementwrapper re-prepares on every call. - Savepoints: Not supported. Calling
savepoint/rollback_to_savepoint/release_savepointreturnsOxiSqlError::Other.
Re-exports§
pub use connection::SqliteConnection;pub use error::SqliteCompatError;
Modules§
- connection
SqliteConnection— Limbo-backed implementation ofoxisql_core::Connection.- error
- Error types for the SQLite-compat (Limbo) backend.
- types
- Value conversions between
limboandoxisql_core.