Crate sqlite_wasm_reader

Source
Expand description

SQLite WASM Reader - A pure Rust SQLite reader for WASI environments

This library provides a lightweight SQLite database reader that can be used in WebAssembly environments, particularly WASI. It supports reading tables, parsing records, and basic database operations without requiring native SQLite bindings.

§Example

use sqlite_wasm_reader::{Database, Error, SelectQuery};

fn main() -> Result<(), Error> {
    let mut db = Database::open("example.db")?;
     
    // List all tables
    let tables = db.tables()?;
    for table in tables {
        println!("Table: {}", table);
    }
     
    // Execute a query using indexes
    let query = SelectQuery::parse("SELECT * FROM users WHERE id = 1")?;
    let rows = db.execute_query(&query)?;
    for row in rows {
        println!("{:?}", row);
    }
     
    Ok(())
}

Re-exports§

pub use error::Error;
pub use error::Result;
pub use database::Database;
pub use value::Value;
pub use logging::Logger;
pub use logging::LogLevel;
pub use logging::init_default_logger;
pub use logging::set_log_level;
pub use logging::log_error;
pub use logging::log_warn;
pub use logging::log_info;
pub use logging::log_debug;
pub use logging::log_trace;
pub use query::SelectQuery;
pub use query::ComparisonOperator;
pub use query::OrderBy;
pub use format::FileHeader;
pub use format::PageType;
pub use page::Page;
pub use btree::BTreeCursor;
pub use btree::Cell;
pub use database::Row;

Modules§

btree
B-tree traversal functionality
database
Main database interface
error
Error types for the SQLite reader library
format
SQLite file format constants and structures
logging
Logging functionality for sqlite_wasm_reader
page
Page reading and parsing functionality
query
SQL query parsing and execution for SELECT statements
record
SQLite record parsing
value
SQLite value types