mirror of
https://gitea.invidious.io/iv-org/shard-crystal-sqlite3.git
synced 2024-08-15 00:53:26 +00:00
Update for ConnectionBuilder
This commit is contained in:
parent
2b41d39269
commit
2e609784f2
1 changed files with 11 additions and 4 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue