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 57 57: def self.unescape_bytea(obj) 58: raise Sequel::Error, "bytea unescaping not supported with this postgres driver. Try using ruby-pg, ruby-postgres, or postgres-pr." 59: 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 35 35: def escape_bytea(obj) 36: self.class.escape_bytea(obj) 37: end
If no valid bytea escaping method can be found, create one that raises an error
# File lib/sequel/adapters/postgres.rb, line 52 52: def escape_bytea(obj) 53: raise Sequel::Error, "bytea escaping not supported with this postgres driver. Try using ruby-pg, ruby-postgres, or postgres-pr." 54: end
If we are using postgres-pr, use the encode_bytea method from that.
# File lib/sequel/adapters/postgres.rb, line 45 45: def escape_bytea(obj) 46: self.class.encode_bytea(obj) 47: 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
Raise an error if no valid string escaping method can be found.
# File lib/sequel/adapters/postgres.rb, line 22 22: def escape_string(obj) 23: if Sequel::Postgres.force_standard_strings 24: str.gsub("'", "''") 25: else 26: raise Sequel::Error, "string escaping not supported with this postgres driver. Try using ruby-pg, ruby-postgres, or postgres-pr." 27: end 28: end