diff options
Diffstat (limited to 'ext/pdo_sqlite/sqlite/src/main.c')
| -rw-r--r-- | ext/pdo_sqlite/sqlite/src/main.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/pdo_sqlite/sqlite/src/main.c b/ext/pdo_sqlite/sqlite/src/main.c index 9f996136f0..daac62f8c3 100644 --- a/ext/pdo_sqlite/sqlite/src/main.c +++ b/ext/pdo_sqlite/sqlite/src/main.c @@ -127,8 +127,18 @@ int sqlite3_close(sqlite3 *db){ } #endif - /* If there are any outstanding VMs, return SQLITE_BUSY. */ sqlite3ResetInternalSchema(db, 0); + + /* If a transaction is open, the ResetInternalSchema() call above + ** will not have called the xDisconnect() method on any virtual + ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback() + ** call will do so. We need to do this before the check for active + ** SQL statements below, as the v-table implementation may be storing + ** some prepared statements internally. + */ + sqlite3VtabRollback(db); + + /* If there are any outstanding VMs, return SQLITE_BUSY. */ if( db->pVdbe ){ sqlite3Error(db, SQLITE_BUSY, "Unable to close due to unfinalised statements"); @@ -149,8 +159,6 @@ int sqlite3_close(sqlite3 *db){ return SQLITE_ERROR; } - sqlite3VtabRollback(db); - for(j=0; j<db->nDb; j++){ struct Db *pDb = &db->aDb[j]; if( pDb->pBt ){ |
