mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
Fix RewindAwait branching when cursor is empty
Even if we have a page, the cursor can still be empty if there are no records.
This commit is contained in:
@@ -108,7 +108,7 @@ impl BTreeCursor {
|
||||
|
||||
impl Cursor for BTreeCursor {
|
||||
fn is_empty(&self) -> bool {
|
||||
self.page.borrow().is_none()
|
||||
self.record.borrow().is_none()
|
||||
}
|
||||
|
||||
fn rewind(&mut self) -> Result<CursorResult<()>> {
|
||||
@@ -147,8 +147,4 @@ impl Cursor for BTreeCursor {
|
||||
fn record(&self) -> Result<Ref<Option<OwnedRecord>>> {
|
||||
Ok(self.record.borrow())
|
||||
}
|
||||
|
||||
fn has_record(&self) -> bool {
|
||||
self.record.borrow().is_some()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,5 +87,4 @@ pub trait Cursor {
|
||||
fn wait_for_completion(&mut self) -> Result<()>;
|
||||
fn rowid(&self) -> Result<Ref<Option<u64>>>;
|
||||
fn record(&self) -> Result<Ref<Option<OwnedRecord>>>;
|
||||
fn has_record(&self) -> bool;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ impl Program {
|
||||
} => {
|
||||
let cursor = cursors.get_mut(cursor_id).unwrap();
|
||||
cursor.wait_for_completion()?;
|
||||
if cursor.has_record() {
|
||||
if !cursor.is_empty() {
|
||||
state.pc = *pc_if_next;
|
||||
} else {
|
||||
state.pc += 1;
|
||||
|
||||
Reference in New Issue
Block a user