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>,
/* private fields */
}
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
sourceimpl Database
impl Database
sourcepub fn new(file: AccessPagedData, initsql: &str, builtins: Arc<BuiltinMap>) -> DB
pub fn new(file: AccessPagedData, initsql: &str, builtins: Arc<BuiltinMap>) -> DB
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.
sourcepub fn run(self: &DB, source: &str, tr: &mut dyn Transaction)
pub fn run(self: &DB, source: &str, tr: &mut dyn Transaction)
Run a batch of SQL.
sourcepub fn run_timed(self: &DB, source: &str, tr: &mut dyn Transaction)
pub fn run_timed(self: &DB, source: &str, tr: &mut dyn Transaction)
Run a batch of SQL, printing the execution time.
sourcepub fn save(self: &DB) -> usize
pub fn save(self: &DB) -> usize
Save updated tables to underlying file ( or rollback if there was an error ). Returns the number of logical pages that were updated.
pub fn table(self: &DB, schema: &str, name: &str) -> Rc<Table>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Database
impl !Send for Database
impl !Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more