module Torque::PostgreSQL::Adapter::Quoting

Constants

Name

Public Instance Methods

quote_default_expression(value, column) click to toggle source
Calls superclass method
# File lib/torque/postgresql/adapter/quoting.rb, line 22
def quote_default_expression(value, column)
  if value.class <= Array
    quote(value) + '::' + column.sql_type
  else
    super
  end
end
quote_type_name(string, schema = nil) click to toggle source

Quotes type names for use in SQL queries.

# File lib/torque/postgresql/adapter/quoting.rb, line 11
def quote_type_name(string, schema = nil)
  name_schema, table = string.to_s.scan(/[^".\s]+|"[^"]*"/)
  if table.nil?
    table = name_schema
    name_schema = nil
  end

  schema = schema || name_schema || 'public'
  Name.new(schema, table).quoted
end

Private Instance Methods

_quote(value) click to toggle source
Calls superclass method
# File lib/torque/postgresql/adapter/quoting.rb, line 32
def _quote(value)
  return super unless value.is_a?(Array)

  values = value.map(&method(:quote))
  "ARRAY[#{values.join(','.freeze)}]"
end
_type_cast(value) click to toggle source
Calls superclass method
# File lib/torque/postgresql/adapter/quoting.rb, line 39
def _type_cast(value)
  return super unless value.is_a?(Array)
  value.map(&method(:quote)).join(','.freeze)
end