pub struct BTreeTable {
pub root_page: i64,
pub name: String,
pub primary_key_columns: Vec<(String, SortOrder)>,
pub has_rowid: bool,
pub is_strict: bool,
pub has_autoincrement: bool,
pub unique_sets: Vec<UniqueSet>,
pub foreign_keys: Vec<Arc<ForeignKey>>,
pub check_constraints: Vec<CheckConstraint>,
pub rowid_alias_conflict_clause: Option<ResolveType>,
pub has_virtual_columns: bool,
pub logical_to_physical_map: Vec<usize>,
/* private fields */
}Fields§
§root_page: i64§name: String§primary_key_columns: Vec<(String, SortOrder)>§has_rowid: bool§is_strict: bool§has_autoincrement: bool§unique_sets: Vec<UniqueSet>§foreign_keys: Vec<Arc<ForeignKey>>§check_constraints: Vec<CheckConstraint>§rowid_alias_conflict_clause: Option<ResolveType>ON CONFLICT clause for the INTEGER PRIMARY KEY constraint. Stored here because rowid-alias PKs have their UniqueSet removed.
has_virtual_columns: bool§logical_to_physical_map: Vec<usize>Implementations§
Source§impl BTreeTable
impl BTreeTable
pub fn new( root_page: i64, name: String, primary_key_columns: Vec<(String, SortOrder)>, columns: Vec<Column>, characteristics: BTreeCharacteristics, unique_sets: Vec<UniqueSet>, foreign_keys: Vec<Arc<ForeignKey>>, check_constraints: Vec<CheckConstraint>, rowid_alias_conflict_clause: Option<ResolveType>, ) -> Self
pub fn columns(&self) -> &[Column]
pub fn columns_mut(&mut self) -> ColumnsMut<'_>
Sourcepub fn type_check_table_ref(
table: &Arc<BTreeTable>,
schema: &Schema,
) -> Arc<BTreeTable> ⓘ
pub fn type_check_table_ref( table: &Arc<BTreeTable>, schema: &Schema, ) -> Arc<BTreeTable> ⓘ
Create a table reference for TypeCheck where custom type columns have
their ty_str replaced with the base type name, and where virtual columns
are skipped. This ensures TypeCheck validates the encoded value against the
correct base type (e.g., BLOB) rather than accepting any STRICT type via the wildcard arm.
Sourcepub fn input_type_check_table_ref(
table: &Arc<BTreeTable>,
schema: &Schema,
only_columns: Option<&ColumnMask>,
) -> Result<Arc<BTreeTable>>
pub fn input_type_check_table_ref( table: &Arc<BTreeTable>, schema: &Schema, only_columns: Option<&ColumnMask>, ) -> Result<Arc<BTreeTable>>
Create a table ref for pre-encode TypeCheck that validates user input
against the type’s declared value input type (or base if not declared).
For UPDATE, only_columns limits which columns are checked — non-SET
columns hold encoded values and must be skipped (set to ANY).
Sourcepub fn resolve_custom_type_affinities(&mut self, schema: &Schema)
pub fn resolve_custom_type_affinities(&mut self, schema: &Schema)
Override column type metadata for custom type columns so that SQLite’s name-based type/affinity rules use the BASE type instead of the custom type name (e.g. “doubled” contains “DOUB” which would incorrectly map to REAL instead of INTEGER).
Sourcepub fn propagate_domain_constraints(&mut self, schema: &Schema) -> Result<()>
pub fn propagate_domain_constraints(&mut self, schema: &Schema) -> Result<()>
Propagate domain NOT NULL and CHECK constraints to table columns. For each column whose type resolves to a domain, this:
- Sets the column’s NOT NULL flag if any domain in the chain has NOT NULL
- Adds domain CHECK constraints (with
valuerewritten to the column name) to the table’s check_constraints list
pub fn get_rowid_alias_column(&self) -> Option<(usize, &Column)>
pub fn has_virtual_columns(&self) -> bool
Sourcepub fn column_layout(&self) -> Result<ColumnLayout, TryReserveError>
pub fn column_layout(&self) -> Result<ColumnLayout, TryReserveError>
Build a ColumnLayout for this table’s register mapping.
Sourcepub fn get_column(&self, name: &str) -> Option<(usize, &Column)>
pub fn get_column(&self, name: &str) -> Option<(usize, &Column)>
Returns the column position and column for a given column name. Returns None if the column name is not found. E.g. if table is CREATE TABLE t (a, b, c) then get_column(“b”) returns (1, &Column { .. })
pub fn from_sql(sql: &str, root_page: i64) -> Result<BTreeTable>
Sourcepub fn to_sql(&self) -> String
pub fn to_sql(&self) -> String
Reconstruct the SQL for the table.
FIXME: this makes us incompatible with SQLite since sqlite stores the user-provided SQL as is in
sqlite_schema.sql
For example, if a user creates a table like: CREATE TABLE t (x), we store it as
CREATE TABLE t (x), whereas sqlite stores it with the original extra whitespace.
pub fn column_collations(&self) -> Result<Vec<CollationSeq>>
pub fn logical_to_physical_column(&self, logical: usize) -> usize
pub fn build_logical_to_physical_map( columns: &[Column], primary_key_columns: &[(String, SortOrder)], has_rowid: bool, ) -> Vec<usize>
pub fn try_build_logical_to_physical_map( columns: &[Column], primary_key_columns: &[(String, SortOrder)], has_rowid: bool, ) -> Result<Vec<usize>, TryReserveError>
pub fn prepare_generated_columns(&mut self) -> Result<()>
pub fn shift_generated_column_indices_after_drop( &mut self, dropped_index: usize, ) -> Result<()>
Trait Implementations§
Source§impl Clone for BTreeTable
impl Clone for BTreeTable
Source§fn clone(&self) -> BTreeTable
fn clone(&self) -> BTreeTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BTreeTable
impl Debug for BTreeTable
Auto Trait Implementations§
impl !Freeze for BTreeTable
impl RefUnwindSafe for BTreeTable
impl Send for BTreeTable
impl Sync for BTreeTable
impl Unpin for BTreeTable
impl UnsafeUnpin for BTreeTable
impl UnwindSafe for BTreeTable
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more