Top level module for holding all PostgreSQL-related modules and classes for Sequel. All adapters that connect to PostgreSQL support the following options:
:client_min_messages : | Change the minimum level of messages that PostgreSQL will send to the the client. The PostgreSQL default is NOTICE, the Sequel default is WARNING. Set to nil to not change the server default. Overridable on a per instance basis via the :client_min_messages option. |
:force_standard_strings : | Set to false to not force the use of standard strings. Overridable on a per instance basis via the :force_standard_strings option. |
:search_path : | Set the schema search_path for this Database‘s connections. Allows to to set which schemas do not need explicit qualification, and in which order to check the schemas when an unqualified object is referenced. |
NAN | = | 0.0/0.0 |
PLUS_INFINITY | = | 1.0/0.0 |
MINUS_INFINITY | = | -1.0/0.0 |
TYPE_TRANSLATOR | = | tt = Class.new do def boolean(s) s == 't' end |
# File lib/sequel/adapters/shared/postgres.rb, line 42 42: def bytea(str) 43: str = if str =~ /\A\\x/ 44: # PostgreSQL 9.0+ bytea hex format 45: str[2..-1].gsub(/(..)/){|s| s.to_i(16).chr} 46: else 47: # Historical PostgreSQL bytea escape format 48: str.gsub(/\\(\\|'|[0-3][0-7][0-7])/) {|s| 49: if s.size == 2 then s[1,1] else s[1,3].oct.chr end 50: } 51: end 52: ::Sequel::SQL::Blob.new(str) 53: end
# File lib/sequel/adapters/shared/postgres.rb, line 41 41: def date(s) ::Date.new(*s.split('-').map(&:to_i)) end
# File lib/sequel/adapters/shared/postgres.rb, line 29 29: def float(s) 30: case s 31: when 'NaN' 32: NAN 33: when 'Infinity' 34: PLUS_INFINITY 35: when '-Infinity' 36: MINUS_INFINITY 37: else 38: s.to_f 39: end 40: end