Class: PGconn
- Inherits:
-
Object
- Object
- PGconn
- Defined in:
- lib/postgres-pr/postgres-compat.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host, port, options, tty, database, user, auth) ⇒ PGconn
constructor
A new instance of PGconn.
- #query(sql) ⇒ Object (also: #exec)
Constructor Details
#initialize(host, port, options, tty, database, user, auth) ⇒ PGconn
Returns a new instance of PGconn.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/postgres-pr/postgres-compat.rb', line 11 def initialize(host, port, , tty, database, user, auth) uri = if host.nil? nil elsif host[0] != ?/ "tcp://#{ host }:#{ port }" else "unix:#{ host }/.s.PGSQL.#{ port }" end @db = database @conn = PostgresPR::Connection.new(database, user, auth, uri) end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
25 26 27 |
# File 'lib/postgres-pr/postgres-compat.rb', line 25 def db @db end |
Class Method Details
.escape(str) ⇒ Object
33 34 35 36 |
# File 'lib/postgres-pr/postgres-compat.rb', line 33 def self.escape(str) # TODO: correct? str.gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } end |