pub struct Database {Show 15 fields
pub apd: 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<FxHashMap<String, i64>>,
pub tables: RefCell<FxHashMap<ObjRef, Rc<Table>>>,
pub functions: RefCell<FxHashMap<ObjRef, Rc<Function>>>,
pub lastid: Cell<i64>,
pub err: Cell<bool>,
pub is_new: bool,
pub function_reset: Cell<bool>,
/* private fields */
}
Expand description
Database with SQL-like interface.
Fields§
§apd: AccessPagedData
Page storage.
builtins: Arc<BuiltinMap>
Defined builtin functions.
sys_schema: Rc<Table>
Schema table.
sys_table: Rc<Table>
Table table.
sys_column: Rc<Table>
Column definitions table.
sys_index: Rc<Table>
Index table.
sys_index_col: Rc<Table>
Index column definitions.
sys_function: Rc<Table>
Function (FN) definitions.
schemas: RefCell<FxHashMap<String, i64>>
Cache of loaded Schemas.
tables: RefCell<FxHashMap<ObjRef, Rc<Table>>>
Cache of loaded Tables.
functions: RefCell<FxHashMap<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?
is_new: bool
Is the database new?
function_reset: Cell<bool>
Flag to reset the functions cache after save.
Implementations§
source§impl Database
impl Database
sourcepub fn new(apd: AccessPagedData, initsql: &str, builtins: Arc<BuiltinMap>) -> DB
pub fn new(apd: AccessPagedData, initsql: &str, builtins: Arc<BuiltinMap>) -> DB
Construct a new DB, based on the specified file. initsql is used to initialise 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 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.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl !Send for Database
impl !Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more