1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Verify that the rollback-hook is invoked correctly when a malloc() failure occurs. (CVS 2824)

FossilOrigin-Name: 83c8ae5bee3b6bdb556d2e85fa260ba855742601
This commit is contained in:
danielk1977
2005-12-16 15:24:28 +00:00
parent 71fd80bf5c
commit f3f06bb30c
10 changed files with 98 additions and 66 deletions

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.311 2005/12/16 06:54:02 danielk1977 Exp $
** $Id: main.c,v 1.312 2005/12/16 15:24:29 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -204,8 +204,12 @@ int sqlite3_close(sqlite3 *db){
*/
void sqlite3RollbackAll(sqlite3 *db){
int i;
int inTrans = 0;
for(i=0; i<db->nDb; i++){
if( db->aDb[i].pBt ){
if( sqlite3BtreeIsInTrans(db->aDb[i].pBt) ){
inTrans = 1;
}
sqlite3BtreeRollback(db->aDb[i].pBt);
db->aDb[i].inTrans = 0;
}
@@ -215,7 +219,7 @@ void sqlite3RollbackAll(sqlite3 *db){
}
/* If one has been configured, invoke the rollback-hook callback */
if( db->xRollbackCallback ){
if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
db->xRollbackCallback(db->pRollbackArg);
}
}