Module: Sequel::Postgres::PGArray::DatabaseMethods

Defined in:
lib/sequel/extensions/pg_array.rb

Constant Summary collapse

APOS =
"'".freeze
DOUBLE_APOS =
"''".freeze
ESCAPE_RE =
/("|\\)/.freeze
ESCAPE_REPLACEMENT =
'\\\\\1'.freeze
BLOB_RANGE =
1...-1

Instance Method Summary collapse

Instance Method Details

#bound_variable_arg(arg, conn) ⇒ Object

Handle arrays in bound variables



212
213
214
215
216
217
218
219
220
221
# File 'lib/sequel/extensions/pg_array.rb', line 212

def bound_variable_arg(arg, conn)
  case arg
  when PGArray
    bound_variable_array(arg.to_a)
  when Array
    bound_variable_array(arg)
  else
    super
  end
end

#schema_column_type(db_type) ⇒ Object

Make the column type detection handle registered array types.



224
225
226
227
228
229
230
# File 'lib/sequel/extensions/pg_array.rb', line 224

def schema_column_type(db_type)
  if (db_type =~ /\A([^(]+)(?:\([^(]+\))?\[\]\z/io) && (type = ARRAY_TYPES[$1])
    type
  else
    super
  end
end