Class: Sequel::Mock::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/adapters/mock.rb

Overview

Connection class for Sequel’s mock adapter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db, server, opts) ⇒ Connection

Store the db, server, and opts.



21
22
23
24
25
# File 'lib/sequel/adapters/mock.rb', line 21

def initialize(db, server, opts)
  @db = db
  @server = server
  @opts = opts
end

Instance Attribute Details

#dbObject (readonly)

Sequel::Mock::Database object that created this connection



10
11
12
# File 'lib/sequel/adapters/mock.rb', line 10

def db
  @db
end

#optsObject (readonly)

The specific database options for this connection.



18
19
20
# File 'lib/sequel/adapters/mock.rb', line 18

def opts
  @opts
end

#serverObject (readonly)

Shard this connection operates on, when using Sequel’s sharding support (always :default for databases not using sharding).



15
16
17
# File 'lib/sequel/adapters/mock.rb', line 15

def server
  @server
end

Instance Method Details

#execute(sql) ⇒ Object

Delegate to the db’s #_execute method.



28
29
30
# File 'lib/sequel/adapters/mock.rb', line 28

def execute(sql)
  @db.send(:_execute, self, sql, :log=>false) 
end