1 | #!/usr/bin/python
|
---|
2 |
|
---|
3 | # This test reproduces Python bug #10513
|
---|
4 |
|
---|
5 | import os
|
---|
6 | import sqlite3
|
---|
7 | import sys
|
---|
8 |
|
---|
9 | DBFILE = '/tmp/bug.sqlite3'
|
---|
10 |
|
---|
11 | if __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")
|
---|