Fix for CONPY-98:

If a string has a binary collation/charset it needs to be converted
to a Binary instead of Unicode.
This commit is contained in:
Georg Richter
2020-08-07 14:45:50 +02:00
parent 43211642cd
commit a749c53859
2 changed files with 46 additions and 17 deletions

View File

@ -1015,6 +1015,17 @@ class TestCursor(unittest.TestCase):
self.assertEqual(row[0], 2)
del cur
def test_conpy98(self):
con= create_connection()
cursor=con.cursor()
cursor.execute("SELECT CAST('foo' AS BINARY) AS anon_1 WHERE 1=?", (1,))
row= cursor.fetchone()
self.assertEqual(row[0], b'foo')
cursor.execute("SELECT CAST('foo' AS BINARY) AS anon_1")
row= cursor.fetchone()
self.assertEqual(row[0], b'foo')
del cursor
def test_conpy91(self):
with create_connection() as connection:
with connection.cursor() as cursor: