Struct rustdb::Database [−][src]
pub struct Database {Show 13 fields
pub file: AccessPagedData,
pub builtins: Arc<BuiltinMap>,
pub sys_schema: Rc<Table>,
pub sys_table: Rc<Table>,
pub sys_column: Rc<Table>,
pub sys_index: Rc<Table>,
pub sys_index_col: Rc<Table>,
pub sys_function: Rc<Table>,
pub schemas: RefCell<HashMap<String, i64>>,
pub tables: RefCell<HashMap<ObjRef, Rc<Table>>>,
pub functions: RefCell<HashMap<ObjRef, Rc<Function>>>,
pub lastid: Cell<i64>,
pub err: Cell<bool>,
// some fields omitted
}
Expand description
Database with SQL-like interface.
Fields
file: AccessPagedData
Page storage.
builtins: Arc<BuiltinMap>
Defined builtin functions.
sys_schema: Rc<Table>
sys_table: Rc<Table>
sys_column: Rc<Table>
sys_index: Rc<Table>
sys_index_col: Rc<Table>
sys_function: Rc<Table>
schemas: RefCell<HashMap<String, i64>>
Cache of loaded Schemas.
tables: RefCell<HashMap<ObjRef, Rc<Table>>>
Cache of loaded Tables.
functions: RefCell<HashMap<ObjRef, Rc<Function>>>
Cache of loaded Functions.
lastid: Cell<i64>
Last id generated by INSERT.
err: Cell<bool>
Has there been an error since last save?
Implementations
Construct a new DB, based on the specified file. initsql is used to initialised a new database. builtins specifies the functions callable in SQL code such as SUBSTR, REPLACE etc.
Run a batch of SQL.
Run a batch of SQL, printing the execution time.
Save updated tables to underlying file ( or rollback if there was an error ). Returns the number of logical pages that were updated.