pub struct MemTable {
pub num_columns: usize,
/* private fields */
}Fields§
§num_columns: usizeColumn count for this table (used when creating the table; actual row widths may vary).
Implementations§
Source§impl MemTable
impl MemTable
pub fn set_collation_registry( &mut self, registry: Arc<Mutex<CollationRegistry>>, )
Sourcepub fn add_unique_column_group(&mut self, cols: Vec<usize>)
pub fn add_unique_column_group(&mut self, cols: Vec<usize>)
Register a group of columns that together form a UNIQUE constraint.
Sourcepub fn add_unique_column_group_with_collations(
&mut self,
cols: Vec<usize>,
collations: Vec<Option<String>>,
)
pub fn add_unique_column_group_with_collations( &mut self, cols: Vec<usize>, collations: Vec<Option<String>>, )
Register a group of columns that together form a UNIQUE constraint with explicit per-column collation metadata.
Sourcepub fn remove_unique_column_group_with_collations(
&mut self,
cols: &[usize],
collations: &[Option<String>],
) -> bool
pub fn remove_unique_column_group_with_collations( &mut self, cols: &[usize], collations: &[Option<String>], ) -> bool
Remove one matching UNIQUE constraint from the in-memory table.
TEMP indexes are represented by direct MemTable constraints rather
than a separate B-tree, so DROP INDEX uses this to retire exactly the
enforcement rule that CREATE UNIQUE INDEX installed.
Sourcepub fn unique_column_group_is_valid(
&self,
cols: &[usize],
collations: &[Option<String>],
) -> bool
pub fn unique_column_group_is_valid( &self, cols: &[usize], collations: &[Option<String>], ) -> bool
Return whether the current rows satisfy a proposed UNIQUE constraint.
This is used by TEMP CREATE UNIQUE INDEX before mutating schema
metadata. Builtin collations use the same canonical key encoding as the
installed constraint; custom collations use the exact comparison path.
Sourcepub fn find_unique_conflicts(&self, new_values: &[SqliteValue]) -> Vec<i64>
pub fn find_unique_conflicts(&self, new_values: &[SqliteValue]) -> Vec<i64>
Find rows that conflict with new_values on any UNIQUE constraint.
Returns the rowids of all conflicting rows.
Sourcepub fn alloc_rowid(&mut self) -> i64
pub fn alloc_rowid(&mut self) -> i64
Allocate a new unique rowid.
Sourcepub fn next_rowid_hint(&self) -> i64
pub fn next_rowid_hint(&self) -> i64
Return the next implicit rowid that would be allocated for this table.
Sourcepub fn max_visible_rowid(&self) -> Option<i64>
pub fn max_visible_rowid(&self) -> Option<i64>
Return the maximum currently visible rowid.
Sourcepub fn delete_by_rowid(&mut self, rowid: i64) -> bool
pub fn delete_by_rowid(&mut self, rowid: i64) -> bool
Delete a row by rowid. Returns true if a row was found and deleted.
Sourcepub fn pad_rows_to_column_count(
&mut self,
target_cols: usize,
default_val: &SqliteValue,
)
pub fn pad_rows_to_column_count( &mut self, target_cols: usize, default_val: &SqliteValue, )
Pad all existing rows to have at least target_cols columns,
appending default_val for any missing trailing columns.
Used after ALTER TABLE ADD COLUMN to make pre-existing rows
visible with the new column’s default value.
Sourcepub fn find_by_rowid(&self, rowid: i64) -> Option<usize>
pub fn find_by_rowid(&self, rowid: i64) -> Option<usize>
Find a row by rowid. Returns the index.
Sourcepub fn row_values_by_rowid(&self, rowid: i64) -> Option<&[SqliteValue]>
pub fn row_values_by_rowid(&self, rowid: i64) -> Option<&[SqliteValue]>
Return the values for a rowid, if present.
Sourcepub fn count_rowid_range(
&self,
lower_inclusive: i64,
upper_exclusive: i64,
) -> usize
pub fn count_rowid_range( &self, lower_inclusive: i64, upper_exclusive: i64, ) -> usize
Count rows whose rowid is in [lower_inclusive, upper_exclusive).
Sourcepub fn iter_rows_in_rowid_range(
&self,
lower_inclusive: i64,
upper_exclusive: i64,
) -> impl Iterator<Item = (i64, &[SqliteValue])> + '_
pub fn iter_rows_in_rowid_range( &self, lower_inclusive: i64, upper_exclusive: i64, ) -> impl Iterator<Item = (i64, &[SqliteValue])> + '_
Iterate rows whose rowid is in [lower_inclusive, upper_exclusive).
Sourcepub fn iter_rows(&self) -> impl Iterator<Item = (i64, &[SqliteValue])> + '_
pub fn iter_rows(&self) -> impl Iterator<Item = (i64, &[SqliteValue])> + '_
Iterate all rows as (rowid, values) pairs.
Used by the compat persistence layer to dump table contents to real SQLite format files.
Sourcepub fn insert_row<V>(&mut self, rowid: i64, values: V)where
V: Into<MemRowValues>,
pub fn insert_row<V>(&mut self, rowid: i64, values: V)where
V: Into<MemRowValues>,
Insert a row with an explicit rowid (for loading from file).
This is the public entry point used by the compat persistence
loader. It delegates to the private insert method.