Skip to content

Commit 8363ac8

Browse files
author
Erlend Egeberg Aasland
authored
bpo-44041: Add test for sqlite3 column count (GH-25907)
1 parent 17c4edc commit 8363ac8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Lib/sqlite3/test/dbapi.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,17 @@ def test_last_row_id_insert_o_r(self):
555555
]
556556
self.assertEqual(results, expected)
557557

558+
def test_column_count(self):
559+
# Check that column count is updated correctly for cached statements
560+
select = "select * from test"
561+
res = self.cu.execute(select)
562+
old_count = len(res.description)
563+
# Add a new column and execute the cached select query again
564+
self.cu.execute("alter table test add newcol")
565+
res = self.cu.execute(select)
566+
new_count = len(res.description)
567+
self.assertEqual(new_count - old_count, 1)
568+
558569

559570
class ThreadTests(unittest.TestCase):
560571
def setUp(self):

0 commit comments

Comments
 (0)