From ea15babc09e9e880307b41edfb69fed94f9b85df Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Sat, 6 Aug 2022 05:15:58 +0800 Subject: [PATCH] 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 --- src/db_mysql.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/db_mysql.nim b/src/db_mysql.nim index df878e25af..562847e6b0 100644 --- a/src/db_mysql.nim +++ b/src/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, '\'')