Ticket #29563: test2.py

File test2.py, 794 bytes (added by Andrew Brown, 6 years ago)
Line 
1#!/usr/bin/python
2
3# This test reproduces Python bug #10513
4
5import os
6import sqlite3
7import sys
8
9DBFILE = '/tmp/bug.sqlite3'
10
11if __name__ == "__main__":
12 if os.path.exists(DBFILE):
13 os.unlink(DBFILE)
14 pass
15 conn = sqlite3.connect(DBFILE)
16
17 print("test2.py")
18 print("Python Version: %s" % sys.version)
19 print("SQLite Version: %s" % conn.execute("select sqlite_version()").fetchone()[0])
20
21 cursor = conn.cursor()
22 cursor.execute('create table t(k primary key);')
23 for i in range(3):
24 cursor.execute('insert or replace into t(k) values(?);', (i,))
25 pass
26 c = cursor.execute(' select k from t where k == ?;', (1,))
27 conn.commit()
28 r = c.fetchone()
29 c = cursor.execute(' select k from t where k == ?;', (2,))
30
31 print("No error")
Back to Top