Class | Sequel::Postgres::Adapter
In: | lib/sequel/adapters/postgres.rb
Parent: | ::PGconn

PGconn subclass for connection specific methods used with the pg, postgres, or postgres-pr driver.

### Methods

apply_connection_settings execute prepared_statements reset

### Included Modules

Sequel::Postgres::AdapterMethods

### Public Instance methods

apply_connection_settings()

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.

[Source]

         # File lib/sequel/adapters/postgres.rb, line 121
    121:       def apply_connection_settings
    122:         super
    123:         if Postgres.use_iso_date_format
    124:           sql = "SET DateStyle = 'ISO'"
    125:           @db.log_info(sql)
    126:           execute(sql)
    127:         end
    128:       end

execute(sql, args=nil) {|q| ...}

Execute the given SQL with this connection. If a block is given, yield the results, otherwise, return the number of changed rows.

[Source]

         # File lib/sequel/adapters/postgres.rb, line 132
    132:       def execute(sql, args=nil)
    133:         q = nil
    134:         begin
    135:           q = args ? async_exec(sql, args) : async_exec(sql)
    136:         rescue PGError
    137:           begin
    138:             s = status
    139:           rescue PGError
    140:             raise(Sequel::DatabaseDisconnectError)
    141:           end
    142:           status_ok = (s == Adapter::CONNECTION_OK)
    143:           status_ok ? raise : raise(Sequel::DatabaseDisconnectError)
    144:         ensure
    145:           block if status_ok
    146:         end
    147:         begin
    148:           block_given? ? yield(q) : q.cmd_tuples
    149:         ensure
    150:           q.clear
    151:         end
    152:       end

prepared_statements()

Hash of prepared statements for this connection. Keys are string names of the server side prepared statement, and values are SQL strings.

[Source]

         # File lib/sequel/adapters/postgres.rb, line 164
    164:         def prepared_statements
    165:           @prepared_statements ||= {}
    166:         end

reset(*args, &block)

Reapply the connection settings if the connection is reset.

[Source]

         # File lib/sequel/adapters/postgres.rb, line 155
    155:       def reset(*args, &block)
    156:         super(*args, &block)
    157:         apply_connection_settings
    158:       end

[Validate]