mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-22 16:35:30 +01:00
use Arc not rc and add auto_increment to window
This commit is contained in:
@@ -488,7 +488,6 @@ pub fn translate_insert(
|
||||
|
||||
program.preassign_label_to_next_insn(key_generation_label);
|
||||
if btree_table.has_autoincrement {
|
||||
|
||||
let (_, r_seq, _, _) = autoincrement_meta.unwrap();
|
||||
let r_max = program.alloc_register();
|
||||
|
||||
@@ -500,7 +499,6 @@ pub fn translate_insert(
|
||||
prev_largest_reg: r_max,
|
||||
});
|
||||
|
||||
|
||||
program.emit_insn(Insn::Copy {
|
||||
src_reg: r_seq,
|
||||
dst_reg: insertion.key_register(),
|
||||
|
||||
@@ -17,13 +17,13 @@ use crate::translate::emitter::Resolver;
|
||||
use crate::translate::ProgramBuilder;
|
||||
use crate::translate::ProgramBuilderOpts;
|
||||
use crate::util::normalize_ident;
|
||||
use crate::util::PRIMARY_KEY_AUTOMATIC_INDEX_NAME_PREFIX;
|
||||
use crate::vdbe::builder::CursorType;
|
||||
use crate::vdbe::insn::Cookie;
|
||||
use crate::vdbe::insn::{CmpInsFlags, InsertFlags, Insn};
|
||||
use crate::Connection;
|
||||
use crate::SymbolTable;
|
||||
use crate::{bail_parse_error, Result};
|
||||
use crate::util::PRIMARY_KEY_AUTOMATIC_INDEX_NAME_PREFIX;
|
||||
|
||||
use turso_ext::VTabKind;
|
||||
|
||||
|
||||
@@ -513,6 +513,7 @@ pub fn init_window<'a>(
|
||||
columns: src_columns,
|
||||
is_strict: false,
|
||||
unique_sets: vec![],
|
||||
has_autoincrement: false,
|
||||
});
|
||||
let cursor_buffer_read = program.alloc_cursor_id(CursorType::BTreeTable(buffer_table.clone()));
|
||||
let cursor_buffer_write = program.alloc_cursor_id(CursorType::BTreeTable(buffer_table.clone()));
|
||||
|
||||
@@ -1966,7 +1966,7 @@ pub fn op_mem_max(
|
||||
program: &Program,
|
||||
state: &mut ProgramState,
|
||||
insn: &Insn,
|
||||
pager: &Rc<Pager>,
|
||||
pager: &Arc<Pager>,
|
||||
mv_store: Option<&Arc<MvStore>>,
|
||||
) -> Result<InsnFunctionStepResult> {
|
||||
load_insn!(MemMax { dest_reg, src_reg }, insn);
|
||||
|
||||
@@ -198,9 +198,9 @@ pub enum Insn {
|
||||
},
|
||||
/// Updates the value of register dest_reg to the maximum of its current
|
||||
/// value and the value in src_reg.
|
||||
///
|
||||
///
|
||||
/// - dest_reg = max(int(dest_reg), int(src_reg))
|
||||
///
|
||||
///
|
||||
/// Both registers are converted to integers before the comparison.
|
||||
MemMax {
|
||||
dest_reg: usize, // P1
|
||||
@@ -1190,11 +1190,11 @@ impl InsnVariants {
|
||||
InsnVariants::IfPos => execute::op_if_pos,
|
||||
InsnVariants::NotNull => execute::op_not_null,
|
||||
InsnVariants::Eq
|
||||
| InsnVariants::Ne
|
||||
| InsnVariants::Lt
|
||||
| InsnVariants::Le
|
||||
| InsnVariants::Gt
|
||||
| InsnVariants::Ge => execute::op_comparison,
|
||||
| InsnVariants::Ne
|
||||
| InsnVariants::Lt
|
||||
| InsnVariants::Le
|
||||
| InsnVariants::Gt
|
||||
| InsnVariants::Ge => execute::op_comparison,
|
||||
InsnVariants::If => execute::op_if,
|
||||
InsnVariants::IfNot => execute::op_if_not,
|
||||
InsnVariants::OpenRead => execute::op_open_read,
|
||||
@@ -1232,9 +1232,9 @@ impl InsnVariants {
|
||||
InsnVariants::SeekRowid => execute::op_seek_rowid,
|
||||
InsnVariants::DeferredSeek => execute::op_deferred_seek,
|
||||
InsnVariants::SeekGE
|
||||
| InsnVariants::SeekGT
|
||||
| InsnVariants::SeekLE
|
||||
| InsnVariants::SeekLT => execute::op_seek,
|
||||
| InsnVariants::SeekGT
|
||||
| InsnVariants::SeekLE
|
||||
| InsnVariants::SeekLT => execute::op_seek,
|
||||
InsnVariants::SeekEnd => execute::op_seek_end,
|
||||
InsnVariants::IdxGE => execute::op_idx_ge,
|
||||
InsnVariants::IdxGT => execute::op_idx_gt,
|
||||
|
||||
Reference in New Issue
Block a user