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>
(cherry picked from commit 3bd935f331)
This commit is contained in:
ringabout
2022-08-06 05:15:58 +08:00
committed by narimiran
parent 33a1e3acb9
commit d79f61e54d
2 changed files with 5 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
import std/db_mysql
doAssert dbQuote("SELECT * FROM foo WHERE col1 = 'bar_baz'") == "'SELECT * FROM foo WHERE col1 = \\'bar_baz\\''"
doAssert dbQuote("SELECT * FROM foo WHERE col1 LIKE '%bar_baz%'") == "'SELECT * FROM foo WHERE col1 LIKE \\'%bar_baz%\\''"