Sqlite since 3.7.11 provides sqlite3_stmt_readonly() API for determining if a prepared statement will affect the database. I made the change, removing the SQL scanning code and replacing it with:
self->is_dml = !sqlite3_stmt_readonly(self->st);
But then I see a number of test failures, mostly related to the fact that table-creation is now treated as "is_dml" with the above change.
I don't know if the above API is going to be a workable path forward, since it seems like DML statements *not* automatically starting a transaction is a behavior a lot of people may have come to depend on (whether or not it is correct).
I've attached a patch just-in-case anyone's interested. |