Update for ConnectionBuilder

This commit is contained in:
Brian J. Cardiff 2023-06-20 21:35:04 -03:00
parent 2b41d39269
commit 2e609784f2

View file

@ -1,9 +1,16 @@
class SQLite3::Driver < DB::Driver class SQLite3::Driver < DB::Driver
def connection_builder(uri : URI) : Proc(::DB::Connection) class ConnectionBuilder < ::DB::ConnectionBuilder
def initialize(@options : ::DB::Connection::Options, @sqlite3_options : SQLite3::Connection::Options)
end
def build : ::DB::Connection
SQLite3::Connection.new(@options, @sqlite3_options)
end
end
def connection_builder(uri : URI) : ::DB::ConnectionBuilder
params = HTTP::Params.parse(uri.query || "") params = HTTP::Params.parse(uri.query || "")
options = connection_options(params) ConnectionBuilder.new(connection_options(params), SQLite3::Connection::Options.from_uri(uri))
sqlite3_options = SQLite3::Connection::Options.from_uri(uri)
->{ SQLite3::Connection.new(options, sqlite3_options).as(::DB::Connection) }
end end
end end