Expand description
§graphitesql
A pure, safe, no_std-capable Rust re-implementation of SQLite.
graphitesql is a single crate that reads and writes the SQLite version 3
on-disk file format and speaks a large subset of SQLite’s SQL dialect. It
contains no unsafe, depends only on core + alloc, and is designed
to run anywhere from a server to a WebAssembly sandbox.
§Status
graphitesql opens real SQLite databases, runs SQL (SELECT with joins,
aggregates, GROUP BY/ORDER BY/LIMIT; CREATE TABLE, INSERT,
UPDATE, DELETE; transactions), and writes databases the real
sqlite3 opens with PRAGMA integrity_check = ok. It reads WAL-mode
databases (overlaying the -wal). The architecture and remaining breadth
work (indexes on write, more SQL) live in ROADMAP.md.
§Design goals
- File-format compatible. A database created by SQLite must be readable and writable by graphitesql and vice-versa, byte for byte.
- Safe.
#![forbid(unsafe_code)]. No FFI, no C, nounsafeblocks. - Portable.
#![no_std]+alloc. Optionalstdfeature adds a file-backed VFS andstd::error::Errorintegration. - Single crate. Everything (storage, B-tree, SQL, VM) lives here.
§Feature flags
std(default) — enables thestd-file VFS andstd::error::Error. Disable forno_stdtargets; an in-memory VFS is always available.
§Attribution
SQLite is public domain, created by D. Richard Hipp and contributors.
graphitesql uses SQLite’s source and documentation only as a specification
reference; no SQLite code is compiled into this crate. See NOTICE and
ATTRIBUTION.md.
Re-exports§
pub use error::Error;pub use error::Result;pub use exec::Connection;pub use exec::QueryResult;
Modules§
- btree
- B-tree layer: the table and index trees that hold all user data.
- error
- Error and result types.
- exec
- Query execution: the
ConnectionAPI and the read-query executor. - format
- The SQLite version 3 on-disk file format.
- pager
- The pager: turns a
Fileinto numbered fixed-size pages. - schema
- The schema catalog: graphitesql’s view of what tables and indexes exist.
- sql
- The SQL front end: tokenizer, AST, and parser.
- util
- Low-level, fully-specified building blocks shared across the engine.
- vfs
- The OS abstraction layer: graphitesql’s only I/O boundary.
Structs§
- Serial
Type - A SQLite record serial type code.
Enums§
- Value
- A value’s storage class, owning its data.
- Value
Ref - A borrowed view of a
Value, used on hot decode paths to avoid copying.
Constants§
- SQLITE_
FILE_ FORMAT - The version of the SQLite file format graphitesql targets.
- TARGET_
SQLITE_ VERSION - The SQLite release whose documented behavior graphitesql tracks as its
compatibility target. See
ATTRIBUTION.md.
Functions§
- cmp_
values - Compare two values in SQLite’s total ordering:
NULL< numbers < text < blobs; numbers compared numerically, text by byte (theBINARYcollation), blobs bymemcmp. This is the order used for index keys,ORDER BY, and comparisons (collation refinements are layered on top elsewhere).