def self.write_prop(p)
if p.klass.ancestors.include?(Integer)
return "#\{@#{p.symbol} || 'NULL'\}"
elsif p.klass.ancestors.include?(Float)
return "#\{@#{p.symbol} || 'NULL'\}"
elsif p.klass.ancestors.include?(String)
return "'#\{PsqlBackend.escape(@#{p.symbol})\}'"
elsif p.klass.ancestors.include?(Time)
return %|#\{@#{p.symbol} ? "'#\{PsqlBackend.timestamp(@#{p.symbol})\}'" : 'NULL'\}|
elsif p.klass.ancestors.include?(Date)
return %|#\{@#{p.symbol} ? "'#\{PsqlBackend.date(@#{p.symbol})\}'" : 'NULL'\}|
elsif p.klass.ancestors.include?(TrueClass)
return "#\{@#{p.symbol} ? \"'t'\" : 'NULL' \}"
else
return %|#\{@#{p.symbol} ? "'#\{PsqlBackend.escape(@#{p.symbol}.to_yaml)\}'" : "''"\}|
end
end