Class/Module Index [+]

Quicksearch

Sequel::Postgres::AdapterMethods

Methods shared by adapter/connection instances.

Attributes

db[W]
transaction_depth[RW]

Depth of the current transaction on this connection, used to implement multi-level transactions with savepoints.

Public Instance Methods

apply_connection_settings() click to toggle source

Apply connection settings for this connection. Currently, turns standard_conforming_strings ON if Postgres.force_standard_strings is true.

# File lib/sequel/adapters/shared/postgres.rb, line 114
def apply_connection_settings
  if Postgres.force_standard_strings
    # This setting will only work on PostgreSQL 8.2 or greater
    # and we don't know the server version at this point, so
    # try it unconditionally and rescue any errors.
    execute("SET standard_conforming_strings = ON") rescue nil
  end
  if cmm = Postgres.client_min_messages
    execute("SET client_min_messages = '#{cmm.to_s.upcase}'")
  end
end
last_insert_id(sequence) click to toggle source

Get the last inserted value for the given sequence.

# File lib/sequel/adapters/shared/postgres.rb, line 127
def last_insert_id(sequence)
  sql = SELECT_CURRVAL % sequence
  execute(sql) do |r|
    val = single_value(r)
    return val.to_i if val
  end
end
primary_key(schema, table) click to toggle source

Get the primary key for the given table.

# File lib/sequel/adapters/shared/postgres.rb, line 136
def primary_key(schema, table)
  sql = SELECT_PK[schema, table]
  execute(sql) do |r|
    return single_value(r)
  end
end
sequence(schema, table) click to toggle source

Get the primary key and sequence for the given table.

# File lib/sequel/adapters/shared/postgres.rb, line 144
def sequence(schema, table)
  sql = SELECT_SERIAL_SEQUENCE[schema, table]
  execute(sql) do |r|
    seq = single_value(r)
    return seq if seq
  end
  
  sql = SELECT_CUSTOM_SEQUENCE[schema, table]
  execute(sql) do |r|
    return single_value(r)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.