diff --git a/core/lib.rs b/core/lib.rs index da7c92b9a..2916e31d8 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -805,7 +805,11 @@ impl Connection { QueryMode::Normal, input, )?); - Ok(Statement::new(program, self._db.mv_store.clone(), pager)) + Ok(Statement::new( + program, + self._db.mv_store.clone(), + pager, + )) } _ => unreachable!(), } diff --git a/core/translate/mod.rs b/core/translate/mod.rs index 3281ce41b..badbaac3b 100644 --- a/core/translate/mod.rs +++ b/core/translate/mod.rs @@ -63,9 +63,9 @@ pub fn translate( connection: Arc, syms: &SymbolTable, query_mode: QueryMode, - _input: &str, // TODO: going to be used for CREATE VIEW + input: &str, ) -> Result { - tracing::trace!("querying {}", _input); + tracing::trace!("querying {}", input); let change_cnt_on = matches!( stmt, ast::Stmt::CreateIndex { .. } @@ -102,7 +102,7 @@ pub fn translate( // TODO: bring epilogue here when I can sort out what instructions correspond to a Write or a Read transaction - Ok(program.build(connection, change_cnt_on)) + Ok(program.build(connection, change_cnt_on, input)) } // TODO: for now leaving the return value as a Program. But ideally to support nested parsing of arbitraty diff --git a/core/vdbe/builder.rs b/core/vdbe/builder.rs index d684472d8..b9abed8ed 100644 --- a/core/vdbe/builder.rs +++ b/core/vdbe/builder.rs @@ -868,7 +868,7 @@ impl ProgramBuilder { }); } - pub fn build(mut self, connection: Arc, change_cnt_on: bool) -> Program { + pub fn build(mut self, connection: Arc, change_cnt_on: bool, sql: &str) -> Program { self.resolve_labels(); self.parameters.list.dedup(); @@ -887,6 +887,7 @@ impl ProgramBuilder { change_cnt_on, result_columns: self.result_columns, table_references: self.table_references, + sql: sql.to_string(), } } } diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index c7a78fb0f..ed96043a1 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -384,6 +384,7 @@ pub struct Program { pub change_cnt_on: bool, pub result_columns: Vec, pub table_references: TableReferences, + pub sql: String } impl Program {