PGconn subclass for connection specific methods used with the pg, postgres, or postgres-pr driver.
Apply connection settings for this connection. Current sets the date style to ISO in order make Date object creation in ruby faster, if Postgres.use_iso_date_format is true.
# File lib/sequel/adapters/postgres.rb, line 132 def apply_connection_settings super if Postgres.use_iso_date_format sql = "SET DateStyle = 'ISO'" execute(sql) end @prepared_statements = {} if SEQUEL_POSTGRES_USES_PG end
Raise a Sequel::DatabaseDisconnectError if a PGError is raised and the connection status cannot be determined or it is not OK.
# File lib/sequel/adapters/postgres.rb, line 143 def check_disconnect_errors begin yield rescue PGError =>e begin s = status rescue PGError raise Sequel.convert_exception_class(e, Sequel::DatabaseDisconnectError) end status_ok = (s == Adapter::CONNECTION_OK) status_ok ? raise : raise(Sequel.convert_exception_class(e, Sequel::DatabaseDisconnectError)) ensure block if status_ok end end
Execute the given SQL with this connection. If a block is given, yield the results, otherwise, return the number of changed rows.
# File lib/sequel/adapters/postgres.rb, line 161 def execute(sql, args=nil) q = check_disconnect_errors{@db.log_yield(sql, args){args ? async_exec(sql, args) : async_exec(sql)}} begin block_given? ? yield(q) : q.cmd_tuples ensure q.clear end end
Generated with the Darkfish Rdoc Generator 2.