Class: EventMeter::Stores::Rollup::ActiveRecordPostgres::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/event_meter/stores/rollup/active_record_postgres.rb

Constant Summary collapse

TRANSACTION_COMMANDS =
{
  "BEGIN" => :begin,
  "COMMIT" => :finish,
  "ROLLBACK" => :finish
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection_class) ⇒ Connection

Returns a new instance of Connection.



16
17
18
19
# File 'lib/event_meter/stores/rollup/active_record_postgres.rb', line 16

def initialize(connection_class)
  @connection_class = connection_class
  @transaction_connection = nil
end

Instance Attribute Details

#connection_classObject (readonly)

Returns the value of attribute connection_class.



14
15
16
# File 'lib/event_meter/stores/rollup/active_record_postgres.rb', line 14

def connection_class
  @connection_class
end

Instance Method Details

#exec(sql) ⇒ Object



21
22
23
# File 'lib/event_meter/stores/rollup/active_record_postgres.rb', line 21

def exec(sql)
  with_connection_for(sql) { |connection| connection.exec(sql) }
end

#exec_params(sql, params) ⇒ Object



25
26
27
# File 'lib/event_meter/stores/rollup/active_record_postgres.rb', line 25

def exec_params(sql, params)
  with_connection_for(sql) { |connection| connection.exec_params(sql, params) }
end