Module: Sequel::DataObjects::Postgres::AdapterMethods

Includes:
Postgres::AdapterMethods
Defined in:
lib/sequel/lib/sequel/adapters/do/postgres.rb

Overview

Methods to add to the DataObjects adapter/connection to allow it to work with the shared PostgreSQL code.

Constant Summary

Constants included from Postgres::AdapterMethods

Postgres::AdapterMethods::SELECT_CURRVAL, Postgres::AdapterMethods::SELECT_CUSTOM_SEQUENCE, Postgres::AdapterMethods::SELECT_PK, Postgres::AdapterMethods::SELECT_SERIAL_SEQUENCE

Instance Attribute Summary

Attributes included from Postgres::AdapterMethods

#db, #transaction_depth

Instance Method Summary collapse

Methods included from Postgres::AdapterMethods

#apply_connection_settings, #last_insert_id, #primary_key, #sequence

Instance Method Details

#execute(sql, args = nil) ⇒ Object

Give the DataObjects adapter a direct execute method, which creates a statement with the given sql and executes it.


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sequel/lib/sequel/adapters/do/postgres.rb', line 17

def execute(sql, args=nil)
  command = create_command(sql)
  begin
    if block_given?
      begin
        reader = command.execute_reader
        yield(reader)
      ensure
        reader.close if reader
      end
    else
      command.execute_non_query
    end
  rescue ::DataObjects::Error => e
    raise_error(e)
  end
end