Method: Sequel::Postgres::PGArray#sql_literal_append

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

#sql_literal_append(ds, sql) ⇒ Object

Append the array SQL to the given sql string. If the receiver has a type, add a cast to the database array type.



468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/sequel/extensions/pg_array.rb', line 468

def sql_literal_append(ds, sql)
  at = array_type
  if empty? && at
    sql << "'{}'"
  else
    sql << "ARRAY"
    _literal_append(sql, ds, to_a)
  end
  if at
    sql << '::' << at.to_s << '[]'
  end
end