sqlite_fsr/models/dbfile/dbtable/tablepage/
mod.rs

1use crate::{command::sql::parser::sql_statement::{CreateTableStatement, SelectStatement}};
2
3pub mod interiortablepage;
4pub use interiortablepage::InteriorTablePage;
5
6pub mod leaftablepage;
7pub use leaftablepage::LeafTablePage;
8
9pub mod record;
10pub use record::Record;
11
12pub trait Table {
13    fn to_table_records(&mut self, statement: &SelectStatement, table_description: &CreateTableStatement) -> Vec<Record>;
14}
15
16
17pub enum TablePage<'a> {
18    Leaf(LeafTablePage),
19    Interior(InteriorTablePage<'a>),
20}
21
22impl Table for TablePage<'_> {
23    fn to_table_records(&mut self, statement: &SelectStatement, table_description: &CreateTableStatement) -> Vec<Record> {
24        match self {
25            TablePage::Leaf(p) => p.to_table_records(statement, table_description),
26            TablePage::Interior(p) => p.to_table_records(statement, table_description),
27        }
28    }
29}