mirror of
https://github.com/lloeki/rebel.git
synced 2025-12-06 01:54:40 +01:00
extract dummy escape
This commit is contained in:
parent
8a9b5804fc
commit
421ae6d32e
1 changed files with 5 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue