I use sqlite3 version 2.6.0 python 2.7. Why queries starts with comment ('/* */' or '--') cause an implicit commit?
Example.
#!/usr/bin/python
import os
try:
os.remove('db1')
except OSError:
pass
import sqlite3
cur1 = sqlite3.connect('db1').cursor()
cur2 = sqlite3.connect('db1').cursor()
# In first cursor open a transaction
cur1.execute('CREATE TABLE test(t text);')
cur1.execute('BEGIN;')
cur1.execute('INSERT INTO test(t) VALUES (\'123456\');')
# In first cursor first transaction is invisible.
print 'Cursor 1'
print cur1.execute('SELECT * FROM test;').fetchall()
# In second cursor first transaction is invisible.
print 'Cursor 2'
print cur2.execute('SELECT * FROM test;').fetchall()
# In first cursor execute a query, begin with comments.
# Here is implicit commit!
print 'Cursor 1'
print cur1.execute('/* 123 */ SELECT * FROM test;').fetchall()
# In second cursor data now visible!
print 'Cursor 2'
print cur2.execute('SELECT * FROM test;').fetchall()
After a query with comment at the begin, cursor cur1 implicitly commits its changes. Is it a bug or a feature?