pub struct Table {
pub file: Rc<SortedFile>,
pub info: Rc<ColInfo>,
pub ixlist: RefCell<IxList>,
pub id: i64,
pub id_gen: Cell<i64>,
pub id_gen_dirty: Cell<bool>,
}
Expand description
Database base table. Underlying file, type information about the columns and id allocation.
Fields
file: Rc<SortedFile>
Underlying SortedFile.
info: Rc<ColInfo>
Type information about the columns.
ixlist: RefCell<IxList>
List of indexes. ( Maybe could eliminate the RefCell )
id: i64
Table id in sys.Table.
id_gen: Cell<i64>
Row id allocator.
id_gen_dirty: Cell<bool>
Row id allocator has changed.
Implementations
sourceimpl Table
impl Table
sourcepub fn new(id: i64, root_page: u64, id_gen: i64, info: Rc<ColInfo>) -> Rc<Table>
pub fn new(id: i64, root_page: u64, id_gen: i64, info: Rc<ColInfo>) -> Rc<Table>
Construct a table with specified info.
sourcepub fn free_pages(&self, db: &DB)
pub fn free_pages(&self, db: &DB)
Drop the underlying file storage ( the table is not useable after this ).
sourcepub fn index_from(
self: &Rc<Table>,
b: &Block<'_>,
we: &mut Expr
) -> (Option<CExpPtr<bool>>, Option<CTableExpression>)
pub fn index_from(
self: &Rc<Table>,
b: &Block<'_>,
we: &mut Expr
) -> (Option<CExpPtr<bool>>, Option<CTableExpression>)
Look for indexed table expression based on supplied WHERE expression (we).
sourcepub fn id_get(&self, db: &DB, id: u64) -> Option<(PagePtr, usize)>
pub fn id_get(&self, db: &DB, id: u64) -> Option<(PagePtr, usize)>
Get record with specified id.
sourcepub fn ix_get(
&self,
db: &DB,
key: Vec<Value>,
index: usize
) -> Option<(PagePtr, usize)>
pub fn ix_get(
&self,
db: &DB,
key: Vec<Value>,
index: usize
) -> Option<(PagePtr, usize)>
Get record with matching key, using specified index.
sourcepub fn scan(&self, db: &DB) -> AscⓘNotable traits for Ascimpl Iterator for Asc type Item = (PagePtr, usize);
pub fn scan(&self, db: &DB) -> AscⓘNotable traits for Ascimpl Iterator for Asc type Item = (PagePtr, usize);
Scan all the records in the table.
sourcepub fn scan_id(self: &Rc<Table>, db: &DB, id: i64) -> IdScanⓘNotable traits for IdScanimpl Iterator for IdScan type Item = (PagePtr, usize);
pub fn scan_id(self: &Rc<Table>, db: &DB, id: i64) -> IdScanⓘNotable traits for IdScanimpl Iterator for IdScan type Item = (PagePtr, usize);
Get a single record with specified id.
sourcepub fn scan_key(self: &Rc<Table>, db: &DB, key: Value, index: usize) -> IndexScanⓘNotable traits for IndexScanimpl Iterator for IndexScan type Item = (PagePtr, usize);
pub fn scan_key(self: &Rc<Table>, db: &DB, key: Value, index: usize) -> IndexScanⓘNotable traits for IndexScanimpl Iterator for IndexScan type Item = (PagePtr, usize);
Get records with matching key.
sourcepub fn scan_keys(
self: &Rc<Table>,
db: &DB,
keys: Vec<Value>,
index: usize
) -> IndexScanⓘNotable traits for IndexScanimpl Iterator for IndexScan type Item = (PagePtr, usize);
pub fn scan_keys(
self: &Rc<Table>,
db: &DB,
keys: Vec<Value>,
index: usize
) -> IndexScanⓘNotable traits for IndexScanimpl Iterator for IndexScan type Item = (PagePtr, usize);
Get records with matching keys.
sourcepub fn delete_index(&self, db: &DB, ix: usize)
pub fn delete_index(&self, db: &DB, ix: usize)
Delete the specified index.
sourcepub fn init_index(&self, db: &DB)
pub fn init_index(&self, db: &DB)
Initialises last index ( called just after add_index ).
sourcepub fn access<'d, 't>(&'t self, p: &'d Page, off: usize) -> Access<'d, 't>
pub fn access<'d, 't>(&'t self, p: &'d Page, off: usize) -> Access<'d, 't>
Utility for accessing fields by number.
sourcepub fn write_access<'d, 't>(
&'t self,
p: &'d mut Page,
off: usize
) -> WriteAccess<'d, 't>
pub fn write_access<'d, 't>(
&'t self,
p: &'d mut Page,
off: usize
) -> WriteAccess<'d, 't>
Utility for updating fields by number.
sourcepub fn id_allocated(&self, id: i64)
pub fn id_allocated(&self, id: i64)
Update id allocator if supplied row id exceeds current value.
Auto Trait Implementations
impl !RefUnwindSafe for Table
impl !Send for Table
impl !Sync for Table
impl Unpin for Table
impl !UnwindSafe for Table
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