Escape %00 / \0 in dbQuote (#18015) [backport:1.4]
Fix https://github.com/nim-lang/Nim/issues/17925
This commit is contained in:
parent
3824fd3f9a
commit
99788ee504
1 changed files with 3 additions and 1 deletions
|
|
@ -110,7 +110,9 @@ proc dbQuote*(s: string): string =
|
||||||
## DB quotes the string.
|
## DB quotes the string.
|
||||||
result = "'"
|
result = "'"
|
||||||
for c in items(s):
|
for c in items(s):
|
||||||
if c == '\'': add(result, "''")
|
case c
|
||||||
|
of '\'': add(result, "''")
|
||||||
|
of '\0': add(result, "\\0")
|
||||||
else: add(result, c)
|
else: add(result, c)
|
||||||
add(result, '\'')
|
add(result, '\'')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue