summaryrefslogtreecommitdiff
path: root/Lib/sqlite3/test/dbapi.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-02-01 22:20:12 +0200
committerPetri Lehtinen <petri@digip.org>2012-02-01 22:20:13 +0200
commit0518f470b1bb99b0b8878224942ebf1e18d1e74f (patch)
treeb29a19f36e098881236b45dabc286f1799d08e88 /Lib/sqlite3/test/dbapi.py
parent6ab9813605213dafaea23e2907d25467b6a52178 (diff)
downloadcpython-git-0518f470b1bb99b0b8878224942ebf1e18d1e74f.tar.gz
sqlite3: Handle strings with embedded zeros correctly
Closes #13676.
Diffstat (limited to 'Lib/sqlite3/test/dbapi.py')
-rw-r--r--Lib/sqlite3/test/dbapi.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 6701c227e8..c356d4706c 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -203,6 +203,13 @@ class CursorTests(unittest.TestCase):
def CheckExecuteArgString(self):
self.cu.execute("insert into test(name) values (?)", ("Hugo",))
+ def CheckExecuteArgStringWithZeroByte(self):
+ self.cu.execute("insert into test(name) values (?)", ("Hu\x00go",))
+
+ self.cu.execute("select name from test where id=?", (self.cu.lastrowid,))
+ row = self.cu.fetchone()
+ self.assertEqual(row[0], "Hu\x00go")
+
def CheckExecuteWrongNoOfArgs1(self):
# too many parameters
try: