Class | PGconn |
In: |
lib/sequel/adapters/postgres.rb
|
Parent: | Object |
Attempt to get uniform behavior for the PGconn object no matter if pg, postgres, or postgres-pr is used.
CONNECTION_OK | = | -1 |
decode_bytea | -> | unescape_bytea |
close | -> | finish |
exec | -> | async_exec |
If no valid bytea unescaping method can be found, create one that raises an error
# File lib/sequel/adapters/postgres.rb, line 53 53: def self.unescape_bytea(obj) 54: raise Sequel::Error, "bytea unescaping not supported with this postgres driver. Try using ruby-pg, ruby-postgres, or postgres-pr." 55: end
If there is no escape_bytea instance method, but there is an escape_bytea class method, use that instead.
# File lib/sequel/adapters/postgres.rb, line 31 31: def escape_bytea(obj) 32: self.class.escape_bytea(obj) 33: end
If no valid bytea escaping method can be found, create one that raises an error
# File lib/sequel/adapters/postgres.rb, line 48 48: def escape_bytea(obj) 49: raise Sequel::Error, "bytea escaping not supported with this postgres driver. Try using ruby-pg, ruby-postgres, or postgres-pr." 50: end
If we are using postgres-pr, use the encode_bytea method from that.
# File lib/sequel/adapters/postgres.rb, line 41 41: def escape_bytea(obj) 42: self.class.encode_bytea(obj) 43: end
If there is no escape_string instance method, but there is an escape class method, use that instead.
# File lib/sequel/adapters/postgres.rb, line 17 17: def escape_string(str) 18: Sequel::Postgres.force_standard_strings ? str.gsub("'", "''") : self.class.escape(str) 19: end