On 25/11/16 12:02, Richard Hipp wrote:
> Rather, I presume
> that Python has recently started using the sqlite3_stmt_readonly()
> interface in a new way.

The bigger picture may be helpful.  There is a third party module
developed under the name "pysqlite" which has a long and storied
history.  At some point a copy was folded into Python as a module named
"sqlite3".  There are periodic copies of code changes between the two.

Python has a database API specification named DB-API (PEP 249).  This
mandates common behaviour no matter what the underlying database.
Transactions are expected to be started automatically, committed
automatically (under some circumstances I think), and commit / rollback
are methods on a cursor object.  This presumably matches how Postgres,
Oracle etc function.

Since SQLite doesn't work that way, the pysqlite authors did it
manually.  The execution code would manually parse each statement,
determine what kind of statement it was (makes changes means silently
start a transaction) and behave appropriately.  Needless to say, parsing
statements had various bugs.  Eventually they decided to use
sqlite3_stmt_readonly() instead of parsing, which is how the current
situation arose.  ie the API is used to try and simulate the behaviour
of other databases.

pysqlite does have an option (off by default) to avoid all this silent
transaction stuff.

Roger

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to