1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Attempt to provide a mechanism to do early termination of long-running

statement preparation by invoking the progress handler at strategic points
during sqlite3_parpare().  This experiment shows that sqlite3_prepare() might
leave the resulting prepared statement uninitialized following an interrupt.

FossilOrigin-Name: 79636f2d80aee70832913a78933da2a7e30cc037810b93903ebbc1925ea93fef
This commit is contained in:
drh
2023-01-12 13:25:48 +00:00
parent 8518eaccd7
commit f84cbd1676
7 changed files with 46 additions and 16 deletions

View File

@@ -175,6 +175,23 @@ void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *zFormat, ...){
}
}
/*
** Check for interrupts and invoke progress callback.
*/
void sqlite3ProgressCheck(Parse *p){
sqlite3 *db = p->db;
if( AtomicLoad(&db->u1.isInterrupted) ){
p->nErr++;
p->rc = SQLITE_INTERRUPT;
}
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
if( db->xProgress && db->xProgress(db->pProgressArg) ){
p->nErr++;
p->rc = SQLITE_INTERRUPT;
}
#endif
}
/*
** Add an error message to pParse->zErrMsg and increment pParse->nErr.
**