diff --git a/core/types.rs b/core/types.rs index 93162a01e..2b3bd2e38 100644 --- a/core/types.rs +++ b/core/types.rs @@ -619,20 +619,15 @@ impl Record { } pub enum Cursor { - Table(BTreeCursor), - Index(BTreeCursor), + BTree(BTreeCursor), Pseudo(PseudoCursor), Sorter(Sorter), Virtual(VTabOpaqueCursor), } impl Cursor { - pub fn new_table(cursor: BTreeCursor) -> Self { - Self::Table(cursor) - } - - pub fn new_index(cursor: BTreeCursor) -> Self { - Self::Index(cursor) + pub fn new_btree(cursor: BTreeCursor) -> Self { + Self::BTree(cursor) } pub fn new_pseudo(cursor: PseudoCursor) -> Self { @@ -643,17 +638,10 @@ impl Cursor { Self::Sorter(cursor) } - pub fn as_table_mut(&mut self) -> &mut BTreeCursor { + pub fn as_btree_mut(&mut self) -> &mut BTreeCursor { match self { - Self::Table(cursor) => cursor, - _ => panic!("Cursor is not a table"), - } - } - - pub fn as_index_mut(&mut self) -> &mut BTreeCursor { - match self { - Self::Index(cursor) => cursor, - _ => panic!("Cursor is not an index"), + Self::BTree(cursor) => cursor, + _ => panic!("Cursor is not a btree"), } } diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index 2c516d285..d852b4e18 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -295,7 +295,7 @@ impl ProgramState { .expect("cursor id out of bounds") .as_mut() .expect("cursor not allocated") - .as_table_mut(); + .as_btree_mut(); unsafe { std::mem::transmute(cursor) } } @@ -306,7 +306,7 @@ impl ProgramState { .expect("cursor id out of bounds") .as_mut() .expect("cursor not allocated") - .as_index_mut(); + .as_btree_mut(); unsafe { std::mem::transmute(cursor) } } @@ -770,13 +770,13 @@ impl Program { cursors .get_mut(*cursor_id) .unwrap() - .replace(Cursor::new_table(cursor)); + .replace(Cursor::new_btree(cursor)); } CursorType::BTreeIndex(_) => { cursors .get_mut(*cursor_id) .unwrap() - .replace(Cursor::new_index(cursor)); + .replace(Cursor::new_btree(cursor)); } CursorType::Pseudo(_) => { panic!("OpenReadAsync on pseudo cursor"); @@ -1285,7 +1285,7 @@ impl Program { } } let mut cursors = state.cursors.borrow_mut(); - if let Some(Cursor::Table(btree_cursor)) = cursors.get_mut(*cursor_id).unwrap() + if let Some(Cursor::BTree(btree_cursor)) = cursors.get_mut(*cursor_id).unwrap() { if let Some(ref rowid) = btree_cursor.rowid()? { state.registers[*dest] = OwnedValue::Integer(*rowid as i64); @@ -2826,12 +2826,12 @@ impl Program { cursors .get_mut(*cursor_id) .unwrap() - .replace(Cursor::new_index(cursor)); + .replace(Cursor::new_btree(cursor)); } else { cursors .get_mut(*cursor_id) .unwrap() - .replace(Cursor::new_table(cursor)); + .replace(Cursor::new_btree(cursor)); } state.pc += 1; }