mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-09 02:04:22 +01:00
store Sql String inside Program for reprepare
This commit is contained in:
@@ -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!(),
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ pub fn translate(
|
||||
connection: Arc<Connection>,
|
||||
syms: &SymbolTable,
|
||||
query_mode: QueryMode,
|
||||
_input: &str, // TODO: going to be used for CREATE VIEW
|
||||
input: &str,
|
||||
) -> Result<Program> {
|
||||
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
|
||||
|
||||
@@ -868,7 +868,7 @@ impl ProgramBuilder {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn build(mut self, connection: Arc<Connection>, change_cnt_on: bool) -> Program {
|
||||
pub fn build(mut self, connection: Arc<Connection>, 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +384,7 @@ pub struct Program {
|
||||
pub change_cnt_on: bool,
|
||||
pub result_columns: Vec<ResultSetColumn>,
|
||||
pub table_references: TableReferences,
|
||||
pub sql: String
|
||||
}
|
||||
|
||||
impl Program {
|
||||
|
||||
Reference in New Issue
Block a user