class PGconn
Constants
- PQTRANS_IDLE
- PQTRANS_INERROR
- PQTRANS_INTRANS
- PQTRANS_UNKNOWN
Attributes
db[R]
host[R]
user[R]
Public Class Methods
escape(str)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 55 def self.escape(str) str.gsub("'","''").gsub("\\", "\\\\\\\\") end
escape_string(str)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 67 def self.escape_string(str) str.gsub("'", "''").gsub("\\", "\\\\\\\\") end
new(host, port, options, tty, database, user, auth)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 21 def initialize(host, port, options, tty, database, user, auth) uri = if host.nil? nil elsif host[0] != ?/ "tcp://#{ host }:#{ port }" else "unix:#{ host }/.s.PGSQL.#{ port }" end @host = host @db = database @user = user @conn = PostgresPR::Connection.new(database, user, auth, uri) end
Also aliased as: connect
quote_ident(name)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 91 def self.quote_ident(name) %("#{name}") end
Public Instance Methods
close()
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 36 def close @conn.close end
Also aliased as: finish
escape(str)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 59 def escape(str) self.class.escape(str) end
escape_string(str)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 64 def escape_string(str) case @conn.params['client_encoding'] when /ASCII/, /ISO/, /KOI8/, /WIN/, /LATIN/ def self.escape_string(str) str.gsub("'", "''").gsub("\\", "\\\\\\\\") end else def self.escape_string(str) str.gsub(/'/u, "''").gsub(/\\/u, "\\\\\\\\") end end escape_string(str) end
notice_processor()
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 83 def notice_processor @conn.notice_processor end
notice_processor=(np)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 87 def notice_processor=(np) @conn.notice_processor = np end
query(sql)
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 44 def query(sql) PGresult.new(@conn.query(sql)) end
Also aliased as: exec, exec
transaction_status()
click to toggle source
# File lib/postgres-pr/pg-compat.rb, line 51 def transaction_status @conn.transaction_status end