summaryrefslogtreecommitdiff
path: root/Lib/sqlite3/test/dbapi.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-02-01 22:18:19 +0200
committerPetri Lehtinen <petri@digip.org>2012-02-01 22:18:19 +0200
commit825b25d31db571cdb00f43b4ff45ea9d7edfafd3 (patch)
tree68667bdfd7a4b7390108314a4fc3c3eb10525c8f /Lib/sqlite3/test/dbapi.py
parentcc9c45a7db7a901372ed52a1b4357a23020f2b27 (diff)
downloadcpython-825b25d31db571cdb00f43b4ff45ea9d7edfafd3.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 518b8ae410..202bd38876 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -225,6 +225,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: