diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-07-04 15:54:29 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-04-05 12:18:36 -0400 |
| commit | 86ef507cc73ee4a0a104b334d7ce08ad045e0c76 (patch) | |
| tree | a077e8f2de416e7a2affb898a13982f8136ad8ba /test/sql/test_text.py | |
| parent | 87b1404eda0f6d2e99b3b2a01ae1c641fbe91311 (diff) | |
| download | sqlalchemy-86ef507cc73ee4a0a104b334d7ce08ad045e0c76.tar.gz | |
Double percent signs based on paramstyle, not dialect
This patch moves the "doubling" of percent signs into
the base compiler and makes it completely a product
of whether or not the paramstyle is format/pyformat or
not. Without this paramstyle, percent signs
are not doubled across text(), literal_column(), and
column().
Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197
Fixes: #3740
Diffstat (limited to 'test/sql/test_text.py')
| -rw-r--r-- | test/sql/test_text.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/sql/test_text.py b/test/sql/test_text.py index 4a273e1ee..ca4d10702 100644 --- a/test/sql/test_text.py +++ b/test/sql/test_text.py @@ -317,6 +317,19 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL): checkparams={'y': 6, 'x': 5, 'z': 7} ) + def test_escaping_percent_signs(self): + stmt = text("select '%' where foo like '%bar%'") + self.assert_compile( + stmt, + "select '%' where foo like '%bar%'", + dialect="sqlite" + ) + + self.assert_compile( + stmt, + "select '%%' where foo like '%%bar%%'", + dialect="mysql" + ) class AsFromTest(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = 'default' |
