Support reading db page size using PRAGMA page_size

This commit is contained in:
Anton Harniakou
2025-04-23 16:46:37 +03:00
parent 5c18c1c57a
commit 0a69ea0138
3 changed files with 9 additions and 1 deletions

View File

@@ -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(())

View File

@@ -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);

View File

@@ -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.