14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/sequel/adapters/litedb.rb', line 14
def connect(server)
Sequel.extension :fiber_concurrency if [:fiber, :polyphony].include? Litescheduler.backend
opts = server_opts(server)
opts[:database] = ":memory:" if blank_object?(opts[:database])
sqlite3_opts = {}
sqlite3_opts[:readonly] = typecast_value_boolean(opts[:readonly]) if opts.has_key?(:readonly)
db = ::Litedb.new(opts[:database].to_s, sqlite3_opts)
@raw_db = db
self.transaction_mode = :immediate
if sqlite_version >= 104
db.extended_result_codes = true
end
connection_pragmas.each { |s| log_connection_yield(s, db) { db.execute_batch(s) } }
class << db
attr_reader :prepared_statements
end
db.instance_variable_set(:@prepared_statements, {})
db
end
|