Path: | lib/sequel/adapters/shared/postgres.rb |
Last Update: | Thu Jun 30 21:47:29 -0400 2011 |
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 117 117: def apply_connection_settings 118: if Postgres.force_standard_strings 119: # This setting will only work on PostgreSQL 8.2 or greater 120: # and we don't know the server version at this point, so 121: # try it unconditionally and rescue any errors. 122: execute("SET standard_conforming_strings = ON") rescue nil 123: end 124: if cmm = Postgres.client_min_messages 125: execute("SET client_min_messages = '#{cmm.to_s.upcase}'") 126: end 127: end
Get the primary key for the given table.
# File lib/sequel/adapters/shared/postgres.rb, line 139 139: def primary_key(schema, table) 140: sql = SELECT_PK[schema, table] 141: execute(sql) do |r| 142: return single_value(r) 143: end 144: end
Get the primary key and sequence for the given table.
# File lib/sequel/adapters/shared/postgres.rb, line 147 147: def sequence(schema, table) 148: sql = SELECT_SERIAL_SEQUENCE[schema, table] 149: execute(sql) do |r| 150: seq = single_value(r) 151: return seq if seq 152: end 153: 154: sql = SELECT_CUSTOM_SEQUENCE[schema, table] 155: execute(sql) do |r| 156: return single_value(r) 157: end 158: end