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

Move the 'busy-callback' logic to the pager layer. (CVS 1527)

FossilOrigin-Name: ff70b6d2b60c143e3ada0606ceff97571998c7e3
This commit is contained in:
danielk1977
2004-06-04 06:22:00 +00:00
parent 13adf8a071
commit 24162fe668
12 changed files with 140 additions and 111 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.203 2004/06/02 00:41:09 drh Exp $
** $Id: main.c,v 1.204 2004/06/04 06:22:01 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -570,8 +570,8 @@ void sqlite3_busy_handler(
int (*xBusy)(void*,const char*,int),
void *pArg
){
db->xBusyCallback = xBusy;
db->pBusyArg = pArg;
db->busyHandler.xFunc = xBusy;
db->busyHandler.pArg = pArg;
}
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
@@ -762,7 +762,8 @@ int sqlite3BtreeFactory(
btree_flags |= BTREE_MEMORY;
}
return sqlite3BtreeOpen(zFilename, ppBtree, nCache, btree_flags);
return sqlite3BtreeOpen(zFilename, ppBtree, nCache, btree_flags,
&db->busyHandler);
}
/*
@@ -847,9 +848,7 @@ int sqlite3_prepare(
if( !db->init.busy ){
if( (db->flags & SQLITE_Initialized)==0 ){
int cnt = 1;
while( (rc = sqlite3Init(db, &zErrMsg))==SQLITE_BUSY
&& db->xBusyCallback
&& db->xBusyCallback(db->pBusyArg, "", cnt++)!=0 ){}
rc = sqlite3Init(db, &zErrMsg);
if( rc!=SQLITE_OK ){
goto prepare_out;
}