Method: PgGraph::Data::Column#to_sql

Defined in:
lib/pg_graph/data/data.rb

#to_sqlObject

TODO: Escape sequences FIXME: Not in use (and WRONG!)



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# File 'lib/pg_graph/data/data.rb', line 477

def to_sql
  $stderr.puts "* SHOULDN'T BE CALLED IN DATA.RB **************************"
  raise "Oops"
  if value.nil?
    'NULL'
  else
    if type.ruby_class <= Numeric
      value
    elsif type.ruby_class <= Array
      if value.empty?
        "'{}'"
      else
        "'{'#{value.join("', '")}'}"
      end
    else
      "'#{PG::Connection.escape_string(value.to_s)}'"
    end
  end
end