summary refs log tree commit diff stats
path: root/lib/impure
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-08-06 05:15:58 +0800
committerGitHub <noreply@github.com>2022-08-05 17:15:58 -0400
commit3bd935f33139646431957e3e14d4ce252a9f60c6 (patch)
treec4b2fa99c5abb436a1280f4c3beba8634666c455 /lib/impure
parent3fef2fd52c86ba922187ca03026b09ceb70b5d3d (diff)
downloadNim-3bd935f33139646431957e3e14d4ce252a9f60c6.tar.gz
fixes #20153; do not escape `_` for mysql [backport] (#20164)
* fixes #20153; do not escape `_` for mysql

* add a test

* Update db_mysql.nim

* Update tdb_mysql.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
Diffstat (limited to 'lib/impure')
-rw-r--r--lib/impure/db_mysql.nim3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/impure/db_mysql.nim b/lib/impure/db_mysql.nim
index df878e25a..562847e6b 100644
--- a/lib/impure/db_mysql.nim
+++ b/lib/impure/db_mysql.nim
@@ -117,7 +117,7 @@ when false:
     discard mysql_stmt_close(stmt)
 
 proc dbQuote*(s: string): string =
-  ## DB quotes the string.
+  ## DB quotes the string. Note that this doesn't escape `%` and `_`.
   result = newStringOfCap(s.len + 2)
   result.add "'"
   for c in items(s):
@@ -132,7 +132,6 @@ proc dbQuote*(s: string): string =
     of '"': result.add "\\\""
     of '\'': result.add "\\'"
     of '\\': result.add "\\\\"
-    of '_': result.add "\\_"
     else: result.add c
   add(result, '\'')