abstract class DB::Driver

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.cr

Instance Method Summary

Instance Method Detail

abstract def build_connection(context : ConnectionContext) : Connection #

[View source]
def connection_pool_options(params : HTTP::Params) #

[View source]