mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
When closing a connection, avoid tripping active cursors belonging to a different shared-cache client. Also, if sqlite3_close() is called while there are still active statements belonging to the connection, return SQLITE_BUSY and do not roll back any active transaction.
FossilOrigin-Name: 6071b7cce067c807e040283fc4b7449dc6eca498
This commit is contained in:
@@ -836,7 +836,7 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){
|
||||
** SQL statements below, as the v-table implementation may be storing
|
||||
** some prepared statements internally.
|
||||
*/
|
||||
sqlite3RollbackAll(db, SQLITE_ABORT);
|
||||
sqlite3VtabRollback(db);
|
||||
|
||||
/* Legacy behavior (sqlite3_close() behavior) is to return
|
||||
** SQLITE_BUSY if the connection can not be closed immediately.
|
||||
@@ -848,6 +848,12 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){
|
||||
return SQLITE_BUSY;
|
||||
}
|
||||
|
||||
/* If a transaction is open, roll it back. This also ensures that if
|
||||
** any database schemas have been modified by the current transaction
|
||||
** they are reset. And that the required b-tree mutex is held to make
|
||||
** the the pager rollback and schema reset an atomic operation. */
|
||||
sqlite3RollbackAll(db, SQLITE_OK);
|
||||
|
||||
#ifdef SQLITE_ENABLE_SQLLOG
|
||||
if( sqlite3GlobalConfig.xSqllog ){
|
||||
/* Closing the handle. Fourth parameter is passed the value 2. */
|
||||
|
Reference in New Issue
Block a user