extract dummy escape

This commit is contained in:
Loic Nageleisen 2017-03-01 16:51:07 +01:00
parent 8a9b5804fc
commit 421ae6d32e

View file

@ -258,10 +258,14 @@ module Rebel::SQL
items.join(', ') items.join(', ')
end end
def escape_str(str)
str.tr(@string_quote, @escaped_string_quote)
end
def value(v) def value(v)
case v case v
when Raw then v when Raw then v
when String then raw "'#{v.tr(@string_quote, @escaped_string_quote)}'" when String then raw "'#{escape_str(v)}'"
when Integer then raw v.to_s when Integer then raw v.to_s
when nil then raw 'NULL' when nil then raw 'NULL'
else raise NotImplementedError, v.inspect else raise NotImplementedError, v.inspect