Class: DB::ActiveRecord::Adapter::Postgres
- Inherits:
-
ActiveRecord::ConnectionAdapters::AbstractAdapter
- Object
- ActiveRecord::ConnectionAdapters::AbstractAdapter
- DB::ActiveRecord::Adapter::Postgres
- Defined in:
- lib/db/active_record/adapter/postgres.rb
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(adapter, config) ⇒ Postgres
constructor
A new instance of Postgres.
- #raw_execute(sql, name, **options) ⇒ Object
Constructor Details
#initialize(adapter, config) ⇒ Postgres
Returns a new instance of Postgres.
16 17 18 19 20 |
# File 'lib/db/active_record/adapter/postgres.rb', line 16 def initialize(adapter, config) super(config) @adapter = adapter end |
Instance Method Details
#connect ⇒ Object
22 23 24 |
# File 'lib/db/active_record/adapter/postgres.rb', line 22 def connect @raw_connection ||= @adapter.call end |
#raw_execute(sql, name, **options) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/db/active_record/adapter/postgres.rb', line 26 def raw_execute(sql, name, **) log(sql, name) do connection = self.connect connection.send_query(sql) connection.next_result.to_a end end |