Module | Sequel::DataObjects::Postgres::AdapterMethods |
In: |
lib/sequel/adapters/do/postgres.rb
|
Methods to add to the DataObjects adapter/connection to allow it to work with the shared PostgreSQL code.
Give the DataObjects adapter a direct execute method, which creates a statement with the given sql and executes it.
# File lib/sequel/adapters/do/postgres.rb, line 17 17: def execute(sql, args=nil) 18: command = create_command(sql) 19: begin 20: if block_given? 21: begin 22: reader = command.execute_reader 23: yield(reader) 24: ensure 25: reader.close if reader 26: end 27: else 28: command.execute_non_query 29: end 30: rescue ::DataObjects::Error => e 31: raise_error(e) 32: end 33: end