mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Change prototype for busy callbacks to "int xBusy(void *, int);" (CVS 1573)
FossilOrigin-Name: 4f1cfca5ca703d0068cf8d6222dc8e0cfb7e24b6
This commit is contained in:
@@ -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.216 2004/06/12 00:42:35 danielk1977 Exp $
|
||||
** $Id: main.c,v 1.217 2004/06/12 01:43:26 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -608,7 +608,7 @@ static int sqliteDefaultBusyCallback(
|
||||
*/
|
||||
void sqlite3_busy_handler(
|
||||
sqlite *db,
|
||||
int (*xBusy)(void*,const char*,int),
|
||||
int (*xBusy)(void*,int),
|
||||
void *pArg
|
||||
){
|
||||
db->busyHandler.xFunc = xBusy;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.123 2004/06/10 23:35:50 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.124 2004/06/12 01:43:26 danielk1977 Exp $
|
||||
*/
|
||||
#include "os.h" /* Must be first to enable large file support */
|
||||
#include "sqliteInt.h"
|
||||
@@ -1555,7 +1555,7 @@ static int pager_write_pagelist(PgHdr *pList){
|
||||
}while( rc==SQLITE_BUSY &&
|
||||
pPager->pBusyHandler &&
|
||||
pPager->pBusyHandler->xFunc &&
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, "", busy++)
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, busy++)
|
||||
);
|
||||
if( rc!=SQLITE_OK ){
|
||||
return rc;
|
||||
@@ -1639,7 +1639,7 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
|
||||
}while( rc==SQLITE_BUSY &&
|
||||
pPager->pBusyHandler &&
|
||||
pPager->pBusyHandler->xFunc &&
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, "", busy++)
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, busy++)
|
||||
);
|
||||
if( rc!=SQLITE_OK ){
|
||||
return rc;
|
||||
@@ -2030,7 +2030,7 @@ int sqlite3pager_begin(void *pData, int nMaster){
|
||||
}while( rc==SQLITE_BUSY &&
|
||||
pPager->pBusyHandler &&
|
||||
pPager->pBusyHandler->xFunc &&
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, "", busy++)
|
||||
pPager->pBusyHandler->xFunc(pPager->pBusyHandler->pArg, busy++)
|
||||
);
|
||||
if( rc!=SQLITE_OK ){
|
||||
return rc;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
** This header file defines the interface that the SQLite library
|
||||
** presents to client programs.
|
||||
**
|
||||
** @(#) $Id: sqlite.h.in,v 1.99 2004/06/12 00:42:35 danielk1977 Exp $
|
||||
** @(#) $Id: sqlite.h.in,v 1.100 2004/06/12 01:43:27 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef _SQLITE_H_
|
||||
#define _SQLITE_H_
|
||||
@@ -242,7 +242,7 @@ int sqlite3_complete16(const void *sql);
|
||||
** data structures out from under the executing query and will
|
||||
** probably result in a coredump.
|
||||
*/
|
||||
void sqlite3_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
|
||||
void sqlite3_busy_handler(sqlite*, int(*)(void*,int), void*);
|
||||
|
||||
/*
|
||||
** This routine sets a busy handler that sleeps for a while when a
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** Internal interface definitions for SQLite.
|
||||
**
|
||||
** @(#) $Id: sqliteInt.h,v 1.283 2004/06/12 00:42:35 danielk1977 Exp $
|
||||
** @(#) $Id: sqliteInt.h,v 1.284 2004/06/12 01:43:27 danielk1977 Exp $
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "sqlite3.h"
|
||||
@@ -342,8 +342,8 @@ struct Db {
|
||||
** callback is currently invoked only from within pager.c.
|
||||
*/
|
||||
struct BusyHandler {
|
||||
int (*xFunc)(void *,const char*,int); /* The busy callback */
|
||||
void *pArg; /* First arg to busy callback */
|
||||
int (*xFunc)(void *,int); /* The busy callback */
|
||||
void *pArg; /* First arg to busy callback */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** A TCL Interface to SQLite
|
||||
**
|
||||
** $Id: tclsqlite.c,v 1.83 2004/06/10 10:50:38 danielk1977 Exp $
|
||||
** $Id: tclsqlite.c,v 1.84 2004/06/12 01:43:27 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
|
||||
|
||||
@@ -149,7 +149,7 @@ static void DbDeleteCmd(void *db){
|
||||
** This routine is called when a database file is locked while trying
|
||||
** to execute SQL.
|
||||
*/
|
||||
static int DbBusyHandler(void *cd, const char *zTable, int nTries){
|
||||
static int DbBusyHandler(void *cd, int nTries){
|
||||
SqliteDb *pDb = (SqliteDb*)cd;
|
||||
int rc;
|
||||
char zVal[30];
|
||||
@@ -158,9 +158,8 @@ static int DbBusyHandler(void *cd, const char *zTable, int nTries){
|
||||
|
||||
Tcl_DStringInit(&cmd);
|
||||
Tcl_DStringAppend(&cmd, pDb->zBusy, -1);
|
||||
Tcl_DStringAppendElement(&cmd, zTable);
|
||||
sprintf(zVal, " %d", nTries);
|
||||
Tcl_DStringAppend(&cmd, zVal, -1);
|
||||
sprintf(zVal, "%d", nTries);
|
||||
Tcl_DStringAppendElement(&cmd, zVal);
|
||||
zCmd = Tcl_DStringValue(&cmd);
|
||||
rc = Tcl_Eval(pDb->interp, zCmd);
|
||||
Tcl_DStringFree(&cmd);
|
||||
|
||||
29
src/vdbe.c
29
src/vdbe.c
@@ -43,7 +43,7 @@
|
||||
** in this file for details. If in doubt, do not deviate from existing
|
||||
** commenting and indentation practices when changing or adding code.
|
||||
**
|
||||
** $Id: vdbe.c,v 1.366 2004/06/12 00:42:35 danielk1977 Exp $
|
||||
** $Id: vdbe.c,v 1.367 2004/06/12 01:43:27 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -2378,16 +2378,12 @@ case OP_Transaction: {
|
||||
}
|
||||
rc = sqlite3BtreeBeginTrans(pBt, pOp->p2, db->nMaster);
|
||||
if( rc==SQLITE_BUSY ){
|
||||
if( db->busyHandler.xFunc==0 ){
|
||||
p->pc = pc;
|
||||
p->rc = SQLITE_BUSY;
|
||||
p->pTos = pTos;
|
||||
return SQLITE_BUSY;
|
||||
}else{
|
||||
sqlite3SetString(&p->zErrMsg, sqlite3ErrStr(rc), (char*)0);
|
||||
}
|
||||
p->pc = pc;
|
||||
p->rc = SQLITE_BUSY;
|
||||
p->pTos = pTos;
|
||||
return SQLITE_BUSY;
|
||||
}
|
||||
if( rc!=SQLITE_OK && rc!=SQLITE_READONLY && rc!=SQLITE_BUSY ){
|
||||
if( rc!=SQLITE_OK && rc!=SQLITE_READONLY /* && rc!=SQLITE_BUSY */ ){
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
}
|
||||
@@ -2565,15 +2561,10 @@ case OP_OpenWrite: {
|
||||
}
|
||||
switch( rc ){
|
||||
case SQLITE_BUSY: {
|
||||
if( db->busyHandler.xFunc ){
|
||||
p->pc = pc;
|
||||
p->rc = SQLITE_BUSY;
|
||||
p->pTos = &pTos[1 + (pOp->p2<=0)]; /* Operands must remain on stack */
|
||||
return SQLITE_BUSY;
|
||||
}else{
|
||||
sqlite3SetString(&p->zErrMsg, sqlite3ErrStr(rc), (char*)0);
|
||||
}
|
||||
break;
|
||||
p->pc = pc;
|
||||
p->rc = SQLITE_BUSY;
|
||||
p->pTos = &pTos[1 + (pOp->p2<=0)]; /* Operands must remain on stack */
|
||||
return SQLITE_BUSY;
|
||||
}
|
||||
case SQLITE_OK: {
|
||||
int flags = sqlite3BtreeFlags(pCur->pCursor);
|
||||
|
||||
Reference in New Issue
Block a user