Merge remote-tracking branch 'origin/parsing' into server-work

# Conflicts:
#	Cargo.lock
#	minisql/src/interpreter.rs
#	server/Cargo.toml
#	server/src/main.rs
This commit is contained in:
Jindřich Moravec 2024-01-26 18:48:37 +01:00
commit 595b47dc06
19 changed files with 1113 additions and 30 deletions

View file

@ -58,6 +58,16 @@ impl State {
}
}
/// TODO: return a reference to avoid allocations
pub fn metadata<'a>(&'a self) -> Vec<(String, &'a TableSchema)> {
let mut m = Vec::new();
for (name, pos) in &self.table_name_position_mapping {
let table_schema = self.tables.get(*pos).unwrap().schema();
m.push((name.clone(), table_schema));
}
m
}
fn table_from_name<'a>(&'a self, table_name: &TableName) -> DbResult<&'a Table> {
match self.table_name_position_mapping.get_by_left(table_name) {
Some(table_position) => {
@ -654,4 +664,4 @@ pub fn example() {
println!("{:?}", response);
println!();
}
}
}