1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Add sqlite_progress_handler() API for specifying an progress callback (CVS 1111)

FossilOrigin-Name: ddb364635a207658664ea92fc677cf16a143a938
This commit is contained in:
danielk1977
2003-10-18 09:37:26 +00:00
parent 4df92bbd44
commit 348bb5d6c8
9 changed files with 302 additions and 20 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.142 2003/09/06 22:18:08 drh Exp $
** $Id: main.c,v 1.143 2003/10/18 09:37:26 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -826,6 +826,31 @@ void sqlite_busy_handler(
db->pBusyArg = pArg;
}
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
/*
** This routine sets the progress callback for an Sqlite database to the
** given callback function with the given argument. The progress callback will
** be invoked every nOps opcodes.
*/
void sqlite_progress_handler(
sqlite *db,
int nOps,
int (*xProgress)(void*),
void *pArg
){
if( nOps>0 ){
db->xProgress = xProgress;
db->nProgressOps = nOps;
db->pProgressArg = pArg;
}else{
db->xProgress = 0;
db->nProgressOps = 0;
db->pProgressArg = 0;
}
}
#endif
/*
** This routine installs a default busy handler that waits for the
** specified number of milliseconds before returning 0.