Class: SQLite3Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/railz_lite/models/wrappers/sqlite3_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(db_file_name) ⇒ SQLite3Wrapper

Returns a new instance of SQLite3Wrapper.



4
5
6
7
8
9
10
# File 'lib/railz_lite/models/wrappers/sqlite3_wrapper.rb', line 4

def initialize(db_file_name)
  @db = SQLite3::Database.new(db_file_name)
  @db.results_as_hash = true
  @db.type_translation = true

  @db
end

Instance Method Details

#execute(*args) ⇒ Object



12
13
14
# File 'lib/railz_lite/models/wrappers/sqlite3_wrapper.rb', line 12

def execute(*args)
  @db.execute(*args)
end

#execute2(*args) ⇒ Object



16
17
18
# File 'lib/railz_lite/models/wrappers/sqlite3_wrapper.rb', line 16

def execute2(*args)
  @db.execute2(*args)
end

#insert(*args) ⇒ Object



20
21
22
23
# File 'lib/railz_lite/models/wrappers/sqlite3_wrapper.rb', line 20

def insert(*args)
  execute(*args)
  last_insert_row_id
end