abstract class DB::Driver
- DB::Driver
- Reference
- Object
Overview
Database driver implementors must subclass Driver
,
register with a driver_name using DB#register_driver
and
override the factory method #build_connection
.
require "db"
class FakeDriver < DB::Driver
def build_connection(context : DB::ConnectionContext)
FakeConnection.new context
end
end
DB.register_driver "fake", FakeDriver
Access to this fake datbase will be available with
DB.open "fake://..." do |db|
# ... use db ...
end
Refer to Connection
, Statement
and ResultSet
for further
driver implementation instructions.
Defined in:
db/driver.crInstance Method Summary
- #build_connection(context : ConnectionContext) : Connection
- #connection_pool_options(params : HTTP::Params)