class Upsert::Connection::PG_Connection

@private

Public Instance Methods

binary(v) click to toggle source
# File lib/upsert/connection/PG_Connection.rb, line 26
def binary(v)
  { :value => v.value, :format => 1 }
end
execute(sql, params = nil) click to toggle source
# File lib/upsert/connection/PG_Connection.rb, line 9
def execute(sql, params = nil)
  if params
    # Upsert.logger.debug { %{[upsert] #{sql} with #{params.inspect}} }
    # The following will blow up if you pass a value that cannot be automatically type-casted,
    #   such as passing a string to an integer field.  You'll get an error something along the
    #   lines of: "invalid input syntax for <type>: <value>"
    metal.exec sql, convert_binary(params)
  else
    Upsert.logger.debug { %{[upsert] #{sql}} }
    metal.exec sql
  end
end
in_transaction?() click to toggle source
# File lib/upsert/connection/PG_Connection.rb, line 30
def in_transaction?
  ![PG::PQTRANS_IDLE, PG::PQTRANS_UNKNOWN].include?(metal.transaction_status)
end
quote_ident(k) click to toggle source
# File lib/upsert/connection/PG_Connection.rb, line 22
def quote_ident(k)
  metal.quote_ident k.to_s
end