Fossil SCM
When forcing a rollback following an error, reset all SQL statement first so that the rollback can be successful.
Commit
9515143de5858081603c04e08526810859bc1edf
Parent
b968f023a88a6af…
1 file changed
+4
M
src/db.c
+4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -153,13 +153,17 @@ | ||
| 153 | 153 | ** Force a rollback and shutdown the database |
| 154 | 154 | */ |
| 155 | 155 | void db_force_rollback(void){ |
| 156 | 156 | int i; |
| 157 | 157 | static int busy = 0; |
| 158 | + sqlite3_stmt *pStmt = 0; | |
| 158 | 159 | if( busy || g.db==0 ) return; |
| 159 | 160 | busy = 1; |
| 160 | 161 | undo_rollback(); |
| 162 | + while( (pStmt = sqlite3_next_stmt(g.db,pStmt))!=0 ){ | |
| 163 | + sqlite3_reset(pStmt); | |
| 164 | + } | |
| 161 | 165 | while( pAllStmt ){ |
| 162 | 166 | db_finalize(pAllStmt); |
| 163 | 167 | } |
| 164 | 168 | if( nBegin ){ |
| 165 | 169 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| 166 | 170 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -153,13 +153,17 @@ | |
| 153 | ** Force a rollback and shutdown the database |
| 154 | */ |
| 155 | void db_force_rollback(void){ |
| 156 | int i; |
| 157 | static int busy = 0; |
| 158 | if( busy || g.db==0 ) return; |
| 159 | busy = 1; |
| 160 | undo_rollback(); |
| 161 | while( pAllStmt ){ |
| 162 | db_finalize(pAllStmt); |
| 163 | } |
| 164 | if( nBegin ){ |
| 165 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| 166 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -153,13 +153,17 @@ | |
| 153 | ** Force a rollback and shutdown the database |
| 154 | */ |
| 155 | void db_force_rollback(void){ |
| 156 | int i; |
| 157 | static int busy = 0; |
| 158 | sqlite3_stmt *pStmt = 0; |
| 159 | if( busy || g.db==0 ) return; |
| 160 | busy = 1; |
| 161 | undo_rollback(); |
| 162 | while( (pStmt = sqlite3_next_stmt(g.db,pStmt))!=0 ){ |
| 163 | sqlite3_reset(pStmt); |
| 164 | } |
| 165 | while( pAllStmt ){ |
| 166 | db_finalize(pAllStmt); |
| 167 | } |
| 168 | if( nBegin ){ |
| 169 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| 170 |