Class: EventMeter::Stores::Rollup::ActiveRecordPostgres::Connection
- Inherits:
-
Object
- Object
- EventMeter::Stores::Rollup::ActiveRecordPostgres::Connection
- 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
-
#connection_class ⇒ Object
readonly
Returns the value of attribute connection_class.
Instance Method Summary collapse
- #exec(sql) ⇒ Object
- #exec_params(sql, params) ⇒ Object
-
#initialize(connection_class) ⇒ Connection
constructor
A new instance of Connection.
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_class ⇒ Object (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 |