class Baza::Driver::Sqlite3::Commands

Public Class Methods

new(args) click to toggle source
# File lib/baza/driver/sqlite3/commands.rb, line 2
def initialize(args)
  @db = args.fetch(:db)
end

Public Instance Methods

last_id() click to toggle source
# File lib/baza/driver/sqlite3/commands.rb, line 25
def last_id
  @db.query("SELECT last_insert_rowid() AS id").fetch.fetch(:id).to_i
end
upsert(table_name, updates, terms, args = {}) click to toggle source
# File lib/baza/driver/sqlite3/commands.rb, line 15
def upsert(table_name, updates, terms, args = {})
  Baza::SqlQueries::NonAtomicUpsert.new(
    db: @db,
    table_name: table_name,
    buffer: args[:buffer],
    terms: terms,
    updates: updates
  ).execute
end
upsert_duplicate_key(table_name, updates, terms = {}, args = {}) click to toggle source
# File lib/baza/driver/sqlite3/commands.rb, line 6
def upsert_duplicate_key(table_name, updates, terms = {}, args = {})
  Baza::SqlQueries::SqliteUpsertDuplicateKey.new({
    db: @db,
    table_name: table_name,
    updates: updates,
    terms: terms
  }.merge(args)).execute
end