lib/riddle/query/insert.rb in riddle-2.3.2 vs lib/riddle/query/insert.rb in riddle-2.4.0
- old
+ new
@@ -27,11 +27,10 @@
def columns_to_s
columns.collect { |column|
column.to_s == 'id' ? 'id' : "`#{column}`"
}.join(', ')
-
end
def values_to_s
values.collect { |value_set|
value_set.collect { |value|
@@ -41,10 +40,10 @@
end
def translated_value(value)
case value
when String
- "'#{value.gsub(/['\\]/, '').gsub(/\s+/, ' ')}'"
+ "'#{Riddle::Query.sql_escape(value).gsub(/\s+/, ' ')}'"
when TrueClass, FalseClass
value ? 1 : 0
when Time
value.to_i
when Date