From 610d70378efccd790b649872bfad64693b79ae85 Mon Sep 17 00:00:00 2001 From: Yuriy Dupyn <2153100+omedusyo@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:07:10 +0100 Subject: [PATCH] Remove redundant code --- minisql/src/interpreter2.rs | 38 ++----------------------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/minisql/src/interpreter2.rs b/minisql/src/interpreter2.rs index 2dfb716..7004b1f 100644 --- a/minisql/src/interpreter2.rs +++ b/minisql/src/interpreter2.rs @@ -140,42 +140,6 @@ impl State { Ok(count) } - - // pub async fn interpret(&mut self, db_path: &Path, response_writer: &mut Writer, operation: Operation) -> DbResult<()> { - // use Operation::*; - - // match operation { - // Select(table_position, column_selection, maybe_condition) => { - // let table: &Table = self.table_at(table_position); - // let cursor = table.read().await?; - - // response_writer.write_table_header(&table.schema, &column_selection).await.map_err(|e| RuntimeError::AnyhowError(e))?; - // let count = match maybe_condition { - // None => Self::select_all_rows(&table, cursor, response_writer, column_selection).await?, - // Some(Condition::Eq(eq_column, value)) => Self::select_eq(&table, cursor, response_writer, column_selection, eq_column, value).await? - // }; - // response_writer.write_command_complete(CompleteStatus::Select(count)).await.map_err(|e| RuntimeError::AnyhowError(e)) - // } - // Insert(table_position, values) => { - // let table: &mut Table = self.table_at_mut(table_position); - // let cursor = table.write().await?; - // todo!() - // } - // Delete(table_position, maybe_condition) => { - // let table: &mut Table = self.table_at_mut(table_position); - // let cursor = table.write().await?; - // todo!() - // } - // CreateTable(table_schema) => { - // let table = Table::new(table_schema, Path::new(db_path)).await?; - // self.attach_table(table).await; - // response_writer.write_command_complete(CompleteStatus::CreateTable).await.map_err(|e| RuntimeError::AnyhowError(e)) - // } - // CreateIndex(table_position, column) => { - // todo!() - // } - // } - // } } impl StateHandler { @@ -216,6 +180,8 @@ impl StateHandler { } Delete(table_position, maybe_condition) => { let state = self.state.read().await; + let mut table = state.table_at_mut(table_position).await; + let cursor = table.write().await?; todo!() }