core: Move result row to ProgramState

Move result row to `ProgramState` to mimic what SQLite does where `Vdbe`
struct has a `pResultRow` member. This makes it easier to deal with result
lifetime, but more importantly, eventually lazily parse values at the edges of
the API.
This commit is contained in:
Pekka Enberg
2025-02-06 07:52:00 +02:00
parent 0012e9d556
commit c210821100
20 changed files with 230 additions and 211 deletions

View File

@@ -28,8 +28,9 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> {
if let Some(ref mut rows) = select_query {
loop {
match rows.step()? {
StepResult::Row(row) => {
if let Value::Integer(id) = row.values[0] {
StepResult::Row => {
let row = rows.row().unwrap();
if let Value::Integer(id) = row.values[0].to_value() {
assert_eq!(id, 1, "First insert should have rowid 1");
}
}
@@ -63,8 +64,9 @@ fn test_last_insert_rowid_basic() -> anyhow::Result<()> {
match conn.query("SELECT last_insert_rowid()") {
Ok(Some(ref mut rows)) => loop {
match rows.step()? {
StepResult::Row(row) => {
if let Value::Integer(id) = row.values[0] {
StepResult::Row => {
let row = rows.row().unwrap();
if let Value::Integer(id) = row.values[0].to_value() {
last_id = id;
}
}
@@ -108,8 +110,9 @@ fn test_integer_primary_key() -> anyhow::Result<()> {
let mut select_query = conn.query("SELECT * FROM test_rowid")?.unwrap();
loop {
match select_query.step()? {
StepResult::Row(row) => {
if let Value::Integer(id) = row.values[0] {
StepResult::Row => {
let row = select_query.row().unwrap();
if let Value::Integer(id) = row.values[0].to_value() {
rowids.push(id);
}
}