From 5c18c1c57a8380795be5e7f1074be9d89a99ad70 Mon Sep 17 00:00:00 2001 From: Anton Harniakou Date: Wed, 23 Apr 2025 16:36:43 +0300 Subject: [PATCH 1/3] Draw table if it contains any row Some table can be headerless, for example results of PRAGMA calls --- cli/app.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/app.rs b/cli/app.rs index bb9515660..9e296416e 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -797,7 +797,7 @@ impl<'a> Limbo<'a> { } } - if table.header().is_some() { + if !table.is_empty() { let _ = self.write_fmt(format_args!("{}", table)); } } From 0a69ea0138415a347d2c33a8ed50545464f5d9ff Mon Sep 17 00:00:00 2001 From: Anton Harniakou Date: Wed, 23 Apr 2025 16:46:37 +0300 Subject: [PATCH 2/3] Support reading db page size using PRAGMA page_size --- core/translate/pragma.rs | 7 +++++++ core/vdbe/execute.rs | 1 - vendored/sqlite3-parser/src/parser/ast/mod.rs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/translate/pragma.rs b/core/translate/pragma.rs index 668c1f214..bd120ecb8 100644 --- a/core/translate/pragma.rs +++ b/core/translate/pragma.rs @@ -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(()) diff --git a/core/vdbe/execute.rs b/core/vdbe/execute.rs index de871f54c..e6cba3769 100644 --- a/core/vdbe/execute.rs +++ b/core/vdbe/execute.rs @@ -1447,7 +1447,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); diff --git a/vendored/sqlite3-parser/src/parser/ast/mod.rs b/vendored/sqlite3-parser/src/parser/ast/mod.rs index 1aac9c2c4..d511ddaaf 100644 --- a/vendored/sqlite3-parser/src/parser/ast/mod.rs +++ b/vendored/sqlite3-parser/src/parser/ast/mod.rs @@ -1622,6 +1622,8 @@ pub enum PragmaName { LegacyFileFormat, /// Return the total number of pages in the database file. PageCount, + // `page_size` pragma + PageSize, /// returns information about the columns of a table TableInfo, /// Returns the user version of the database file. From 51fc1773ea82351c4392c6d98f3aee6fee0d6e64 Mon Sep 17 00:00:00 2001 From: Anton Harniakou Date: Thu, 24 Apr 2025 10:36:23 +0300 Subject: [PATCH 3/3] Fix missing documentation warning; improve the documentation message --- vendored/sqlite3-parser/src/parser/ast/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendored/sqlite3-parser/src/parser/ast/mod.rs b/vendored/sqlite3-parser/src/parser/ast/mod.rs index d511ddaaf..74da5b647 100644 --- a/vendored/sqlite3-parser/src/parser/ast/mod.rs +++ b/vendored/sqlite3-parser/src/parser/ast/mod.rs @@ -1622,7 +1622,7 @@ pub enum PragmaName { LegacyFileFormat, /// Return the total number of pages in the database file. PageCount, - // `page_size` pragma + /// Return the page size of the database in bytes. PageSize, /// returns information about the columns of a table TableInfo,