sqlite-vdbe
Low-level access to SQLite's VDBE (Virtual Database Engine) bytecode.
This crate allows you to create and execute VDBE programs directly, bypassing SQL parsing. This is useful for:
- Building custom query engines on top of SQLite's storage
- Testing VDBE behavior
- Learning how SQLite works internally
- Implementing specialized database operations
Installation
Add this to your Cargo.toml:
[]
= "0.0.3"
SQLite 3.51.2 is bundled and compiled automatically during build.
Quick Start
use ;
API Overview
Instructions
The Insn enum provides a type-safe way to build VDBE programs:
use Insn;
// Load constants
Integer
Null
// Arithmetic
Add
Subtract
Multiply
// Control flow
Goto
If
Halt
// Results
ResultRow
// Comparisons
Eq
Lt
Forward Jumps
Use jump_here() to patch forward jumps:
let jump_addr = builder.add;
builder.add; // Skipped
builder.jump_here; // Patch jump to here
builder.add; // Executed
Thread Safety
This crate compiles SQLite with SQLITE_THREADSAFE=0 for simplicity. All types are !Send and !Sync. Use one connection per thread.
Features
bundled(default): Compiles the bundled SQLite 3.51.2 amalgamation
Requirements
- A C compiler (cc)