mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
Merge 'Pragma page size reading' from Anton Harniakou
1) Fix a bug where cli pretty mode would not print pragma results; 2) Add ability to read page_size using PRAGMA page_size; Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #1394
This commit is contained in:
commit
2e8042510e
4 changed files with 10 additions and 2 deletions
|
@ -797,7 +797,7 @@ impl<'a> Limbo<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
if table.header().is_some() {
|
||||
if !table.is_empty() {
|
||||
let _ = self.write_fmt(format_args!("{}", table));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,6 +160,9 @@ fn update_pragma(
|
|||
// getting here
|
||||
unreachable!();
|
||||
}
|
||||
PragmaName::PageSize => {
|
||||
todo!("updating page_size is not yet implemented")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,6 +260,10 @@ fn query_pragma(
|
|||
});
|
||||
program.emit_result_row(register, 1);
|
||||
}
|
||||
PragmaName::PageSize => {
|
||||
program.emit_int(database_header.lock().page_size.into(), register);
|
||||
program.emit_result_row(register, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -1448,7 +1448,6 @@ pub fn op_result_row(
|
|||
values: &state.registers[*start_reg] as *const Register,
|
||||
count: *count,
|
||||
};
|
||||
|
||||
state.result_row = Some(row);
|
||||
state.pc += 1;
|
||||
return Ok(InsnFunctionStepResult::Row);
|
||||
|
|
|
@ -1622,6 +1622,8 @@ pub enum PragmaName {
|
|||
LegacyFileFormat,
|
||||
/// Return the total number of pages in the database file.
|
||||
PageCount,
|
||||
/// Return the page size of the database in bytes.
|
||||
PageSize,
|
||||
/// returns information about the columns of a table
|
||||
TableInfo,
|
||||
/// Returns the user version of the database file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue