97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
int (*xHook)(void); /* Functions to call at db_end_transaction() */
int sequence; /* Call functions in sequence order */
} aHook[5];
static Stmt *pAllStmt = 0; /* List of all unfinalized statements */
/*
** This routine is called by the SQLite commit-hook mechanism
** just prior to each omit. All this routine does is verify
** that nBegin really is zero. That insures that transactions
** cannot commit by any means other than by calling db_end_transaction()
** below.
**
** This is just a safety and sanity check.
*/
static int db_verify_at_commit(void *notUsed){
|
|
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
int (*xHook)(void); /* Functions to call at db_end_transaction() */
int sequence; /* Call functions in sequence order */
} aHook[5];
static Stmt *pAllStmt = 0; /* List of all unfinalized statements */
/*
** This routine is called by the SQLite commit-hook mechanism
** just prior to each commit. All this routine does is verify
** that nBegin really is zero. That insures that transactions
** cannot commit by any means other than by calling db_end_transaction()
** below.
**
** This is just a safety and sanity check.
*/
static int db_verify_at_commit(void *notUsed){
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
doRollback |= aHook[i].xHook();
}
db_multi_exec(doRollback ? "ROLLBACK" : "COMMIT");
doRollback = 0;
}
}
void db_force_rollback(void){
if( nBegin ){
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
if( isNewRepo ){
db_close();
unlink(g.zRepositoryName);
}
}
nBegin = 0;
}
/*
** Install a commit hook. Hooks are installed in sequence order.
** It is an error to install the same commit hook more than once.
**
** Each commit hook is called (in order of accending sequence) at
|
>
>
>
>
>
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
doRollback |= aHook[i].xHook();
}
db_multi_exec(doRollback ? "ROLLBACK" : "COMMIT");
doRollback = 0;
}
}
void db_force_rollback(void){
static int busy = 0;
if( busy ) return;
busy = 1;
undo_rollback();
if( nBegin ){
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
if( isNewRepo ){
db_close();
unlink(g.zRepositoryName);
}
}
nBegin = 0;
busy = 0;
}
/*
** Install a commit hook. Hooks are installed in sequence order.
** It is an error to install the same commit hook more than once.
**
** Each commit hook is called (in order of accending sequence) at
|