Class: SQLite
Instance Method Summary
collapse
Methods inherited from Database
#delete, #insert, #select, #update
Constructor Details
#initialize(db) ⇒ SQLite
Returns a new instance of SQLite.
4
5
6
|
# File 'lib/db/sqlite.rb', line 4
def initialize(db)
connect db
end
|
Instance Method Details
#connect(addr) ⇒ Object
11
12
13
|
# File 'lib/db/sqlite.rb', line 11
def connect(addr)
@db = SQLite3::Database.new addr
end
|
#disconnect ⇒ Object
14
15
16
|
# File 'lib/db/sqlite.rb', line 14
def disconnect
@db.close
end
|
#dispose ⇒ Object
7
8
9
|
# File 'lib/db/sqlite.rb', line 7
def dispose
disconnect
end
|
#execute(query) ⇒ Object
21
22
23
|
# File 'lib/db/sqlite.rb', line 21
def execute(query)
@db.execute query
end
|
#prepare(query) ⇒ Object
18
19
20
|
# File 'lib/db/sqlite.rb', line 18
def prepare(query)
@db.prepare query
end
|