Message360665
With Berker Peksag's patch merged in 2016, in the default non auto-commit mode, sqlite3 implicitly issues a BEGIN statement before any non SELECT statement not already in a transaction, EXCEPT DDL statements, for backwards compatibility reasons:
+ /* For backwards compatibility reasons, do not start a transaction if a
+ DDL statement is encountered. If anybody wants transactional DDL,
+ they can issue a BEGIN statement manually. */
+ if (self->connection->begin_statement && !sqlite3_stmt_readonly(self->statement->st) && !self->statement->is_ddl) {
+ if (sqlite3_get_autocommit(self->connection->db)) {
+ result = _pysqlite_connection_begin(self->connection);
+ if (!result) {
+ goto error;
+ }
+ Py_DECREF(result);
}
}
Is there any plan to cover DDL statements as well in a future Python version and deprecate the old behaviour? That would avoid having to insert BEGIN statements manually for getting transactional DDL statements, like in psycopg2 for PostgreSQL databases. |
|
Date |
User |
Action |
Args |
2020-01-25 00:23:39 | maggyero | set | recipients:
+ maggyero, ghaering, pitrou, ned.deily, Jeremy Banks, r.david.murray, zzzeek, asvetlov, flox, adamtj, dholth, torsten, monsanto, scott.urban, aymeric.augustin, tshepang, python-dev, Ronny.Pfannschmidt, berker.peksag, Mark.Bucciarelli, Jim.Jewett, steve.dower, malin, bulb, bkircher, carlwgeorge |
2020-01-25 00:23:39 | maggyero | set | messageid: <1579911819.54.0.258685162008.issue10740@roundup.psfhosted.org> |
2020-01-25 00:23:39 | maggyero | link | issue10740 messages |
2020-01-25 00:23:39 | maggyero | create | |
|