| 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: yield(reader = @db.log_yield(sql){command.execute_reader})
23: ensure
24: reader.close if reader
25: end
26: else
27: @db.log_yield(sql){command.execute_non_query}
28: end
29: rescue ::DataObjects::Error => e
30: @db.send(:raise_error, e)
31: end
32: end