DelegateClass(Array)
Base class for the PostgreSQL array types. Subclasses generally just deal with parsing, so instances manually created from arrays can use this class correctly.
Append the array SQL to the given sql string. If the receiver has a type, add a cast to the database array type.
# File lib/sequel/extensions/pg_array.rb, line 304 304: def sql_literal_append(ds, sql) 305: sql << ARRAY 306: _literal_append(sql, ds, to_a) 307: if at = array_type 308: sql << DOUBLE_COLON << at.to_s << EMPTY_BRACKET 309: end 310: end
Recursive method that handles multi-dimensional arrays, surrounding each with [] and interspersing entries with ,.
# File lib/sequel/extensions/pg_array.rb, line 317 317: def _literal_append(sql, ds, array) 318: sql << OPEN_BRACKET 319: comma = false 320: commas = COMMA 321: array.each do |i| 322: sql << commas if comma 323: if i.is_a?(Array) 324: _literal_append(sql, ds, i) 325: else 326: ds.literal_append(sql, i) 327: end 328: comma = true 329: end 330: sql << CLOSE_BRACKET 331: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.