module Sequel::Plugins::PgRow::DatabaseMethods

Constants

COMMA
ESCAPE_RE
ESCAPE_REPLACEMENT

Public Instance Methods

bound_variable_arg(arg, conn) click to toggle source

Handle Sequel::Model instances in bound variables.

Calls superclass method
# File lib/sequel/plugins/pg_row.rb, line 68
def bound_variable_arg(arg, conn)
  case arg
  when Sequel::Model
    "(#{arg.values.values_at(*arg.columns).map{|v| bound_variable_array(v)}.join(COMMA)})"
  else
    super
  end
end
row_type(db_type, v) click to toggle source

If a Sequel::Model instance is given, return it as-is instead of attempting to convert it.

Calls superclass method
# File lib/sequel/plugins/pg_row.rb, line 79
def row_type(db_type, v)
  if v.is_a?(Sequel::Model)
    v
  else
    super
  end
end

Private Instance Methods

bound_variable_array(arg) click to toggle source

Handle Sequel::Model instances in bound variable arrays.

Calls superclass method
# File lib/sequel/plugins/pg_row.rb, line 90
def bound_variable_array(arg)
  case arg
  when Sequel::Model
    "\"(#{arg.values.values_at(*arg.columns).map{|v| bound_variable_array(v)}.join(COMMA).gsub(ESCAPE_RE, ESCAPE_REPLACEMENT)})\""
  else
    super
  end
end