pub struct Database {
Show 14 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>, pub is_new: 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?

is_new: bool

Is the database new?

Implementations

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.

Run a batch of SQL.

Run a batch of SQL, printing the execution time.

Test whether there are unsaved changes.

Save updated tables to underlying file ( or rollback if there was an error ). Returns the number of logical pages that were updated.

Get the named table.

Get the named table ( panics if it does not exist ).

Verify the page structure of the database.

Trait Implementations

Clear function instructions to avoid leaking memory.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.