1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-06-09 06:21:25 +03:00

Change prototype for busy callbacks to "int xBusy(void *, int);" (CVS 1573)

FossilOrigin-Name: 4f1cfca5ca703d0068cf8d6222dc8e0cfb7e24b6
This commit is contained in:
danielk1977 2004-06-12 01:43:26 +00:00
parent dc8453fd7a
commit 2a764eb0cd
10 changed files with 49 additions and 59 deletions

View File

@ -1,5 +1,5 @@
C Use\sthe\sSQLITE_UTF*\ssymbols\sinstead\sof\sthe\sold\sinternal\sTEXT_Utf*\ssymbols.\s(CVS\s1572)
D 2004-06-12T00:42:35
C Change\sprototype\sfor\sbusy\scallbacks\sto\s"int\sxBusy(void\s*,\sint);"\s(CVS\s1573)
D 2004-06-12T01:43:26
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -38,7 +38,7 @@ F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c 68c7f3ddd6a7f1e5596d6996da1a2861b3789a3a
F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f
F src/main.c 59b662fab26dd6f39224971755836f328b426cf3
F src/main.c 86b0946b5d99d4c42437d50494732a316025d141
F src/md5.c 4302e84ae516c616bb079c4e6d038c0addb33481
F src/os.h 23c69c5084e71b5fe199ff1c4e35a4aded0f1380
F src/os_common.h 6393ac67a3a7b4aea19ff17529980ecf77eb2348
@ -48,7 +48,7 @@ F src/os_unix.c 1d6f3d1a87d4aa0e4490bcc47b3f0ff9b2e37e7a
F src/os_unix.h 1cd6133cf66dea704b8646b70b2dfdcbdd9b3738
F src/os_win.c 6b8f9fcc683bb888e07fc485372803baa68faadb
F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c
F src/pager.c 94ecf938607847e21fb794d2841c9a7f05e2ddb7
F src/pager.c 4a2d3c871169385f7fe65c37919ced82cb3d34ed
F src/pager.h ca8f293e1d623a7c628a1c5e0c6cf43d5bbb80bf
F src/parse.y 097438674976355a10cf177bd97326c548820b86
F src/pragma.c e288bd122d3ca41ec2032475abde1ff5fa3095f4
@ -56,10 +56,10 @@ F src/printf.c 63b15f1ea9fe3daa066bb7430fd20d4a2d717dc8
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c d29488f86e61e0d45dff318e1f04ba6a7e5782d0
F src/shell.c ca519519dcbbc582f6d88f7d0e7583b857fd3469
F src/sqlite.h.in 33179b721472c6e2616b7c95f77a0b5b98d30d5a
F src/sqliteInt.h c49c1841842973354bab645d705fdcd8c4b09006
F src/sqlite.h.in a4bee5b5c96d8a19f62c750b370bb05ab9073871
F src/sqliteInt.h 289523cf5337316d85be9b1bb9a067f1d52f80e5
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
F src/tclsqlite.c e974c0b2479ed37334aeb268de331e0a1b21b5a8
F src/tclsqlite.c 689e47545c55dd70e537c1048da47555cb7790ea
F src/test1.c 5f5c0773df1091cc02ddf6608a8f6e0c65940a56
F src/test2.c 05f810c90cf6262d5f352860e87d41a3f34207f9
F src/test3.c beafd0ccf7b9ae784744be1b1e66ffe8f64c25da
@ -71,7 +71,7 @@ F src/update.c 168b6d523087ca4545b74ec9f3102b1f3c6b1e38
F src/utf.c e16737b3fc4201bf7ce9bd8ced5250596aa31b76
F src/util.c 90375fa253137562d536ccdd40b297f0fd7413fc
F src/vacuum.c b921eb778842592e1fb48a9d4cef7e861103878f
F src/vdbe.c 73b2c3d0de81a97f7a0d210c9374f4ba6a17a20c
F src/vdbe.c 230613d7524024c99a30fd67bd16bda0860878fe
F src/vdbe.h 46f74444a213129bc4b5ce40124dd8ed613b0cde
F src/vdbeInt.h 57b7001bc18de348f2180c5fa8a85b687592a19b
F src/vdbeapi.c d7803664ea8bacc109ddb4b96ce8c5785ff60138
@ -123,7 +123,7 @@ F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
F test/lastinsert.test 31382f88b9b0270333ac9e4a17f2c2f4732da718
F test/laststmtchanges.test cabd11bdfbaf73a4486c50b58297d9c2038ccc18
F test/limit.test 60d7f856ee7846f7130dee67f10f0e726cd70b5d
F test/lock.test 65b98e8812489e157a2bd51fb44c520f6bc76e32
F test/lock.test 13cd5f40940c79b2cdea5fff4e70f053d32f6657
F test/main.test 6a851b5992c4881a725a3d9647e629199df8de9d
F test/malloc.test 4e19b96d9cd7d61f4826e6fce03849ad5ad526dd
F test/memdb.test befe8f26d430d07ba65692243a893a0e82a0b866
@ -157,7 +157,7 @@ F test/tclsqlite.test 2ff5abfd1e133cddcfc61ad5850e3b93f4a7ff40
F test/temptable.test 6809810546311140f1f4efb4a4fc679b36495f50
F test/tester.tcl fc10520db0d3ce4ef6a8b5ab91bd102fc3f4280a
F test/thread1.test 52ab8d963691d5a34a7f998d364371c8c725a253
F test/threadtest1.c f7f896e62ed46feae1dc411114a48c15a0f82ee2
F test/threadtest1.c f5c7d628d5b23a1418816351b3cd8fe06e146250
F test/threadtest2.c d94ca4114fd1504f7e0ae724bcd83d4b40931d86
F test/trans.test 4a26c6fa3639202c334521954c17d8abe8a1c8e8
F test/trigger1.test 99b7cd9a568ac60aa04bbc3b9db9575ffa97709a
@ -223,7 +223,7 @@ F www/support.tcl 1801397edd271cc39a2aadd54e701184b5181248
F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 022075517cc0edc5f21de4b92ef188bda2034c98
R abf75eaed31f2acb34d4cd05657f47f8
P 9b84f2f488e1d37ba1a4c4cf31490bcbba0f6edd
R 9710f09de77faaee2416768df891dc21
U danielk1977
Z d06de6886101bf9e57ad7761153b77ce
Z f9730ca2955947853f997709fb7895ea

View File

@ -1 +1 @@
9b84f2f488e1d37ba1a4c4cf31490bcbba0f6edd
4f1cfca5ca703d0068cf8d6222dc8e0cfb7e24b6

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.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;

View File

@ -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;

View File

@ -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

View File

@ -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 */
};
/*

View File

@ -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);

View File

@ -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);

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
# $Id: lock.test,v 1.23 2004/06/10 00:29:12 drh Exp $
# $Id: lock.test,v 1.24 2004/06/12 01:43:27 danielk1977 Exp $
set testdir [file dirname $argv0]
@ -172,8 +172,8 @@ do_test lock-2.2 {
# a RESERVED lock) tries to get a RESERVED lock, we get a busy callback.
#
do_test lock-2.3 {
proc callback {args} {
set ::callback_value $args
proc callback {count} {
set ::callback_value $count
break
}
set ::callback_value {}
@ -181,9 +181,9 @@ do_test lock-2.3 {
set r [catch {execsql {UPDATE t1 SET a=b, b=a} db2} msg]
lappend r $msg
lappend r $::callback_value
} {1 {database is locked} {{} 1}}
} {1 {database is locked} 1}
do_test lock-2.4 {
proc callback {file count} {
proc callback {count} {
lappend ::callback_value $count
if {$count>4} break
}
@ -194,7 +194,7 @@ do_test lock-2.4 {
lappend r $::callback_value
} {1 {database is locked} {1 2 3 4 5}}
do_test lock-2.5 {
proc callback {file count} {
proc callback {count} {
lappend ::callback_value $count
if {$count>4} break
}
@ -210,7 +210,7 @@ do_test lock-2.5 {
# second thread to continue.
#
do_test lock-2.6 {
proc callback {file count} {
proc callback {count} {
lappend ::callback_value $count
if {$count>2} {
execsql {ROLLBACK}
@ -223,7 +223,7 @@ do_test lock-2.6 {
lappend r $::callback_value
} {0 {9 8} {}}
do_test lock-2.7 {
proc callback {file count} {
proc callback {count} {
lappend ::callback_value $count
if {$count>2} {
execsql {ROLLBACK}
@ -281,7 +281,7 @@ do_test lock-4.2 {
lappend rc $msg $::callback_value
} {1 {database is locked} {}}
do_test lock-4.3 {
proc callback {file count} {
proc callback {count} {
lappend ::callback_value $count
if {$count>4} break
}

View File

@ -47,7 +47,7 @@ extern char *sqlite_vmprintf(const char *zFormat, va_list);
/*
** When a lock occurs, yield.
*/
static int db_is_locked(void *NotUsed, const char *zNotUsed, int iNotUsed){
static int db_is_locked(void *NotUsed, int iNotUsed){
/* sched_yield(); */
if( verbose ) printf("BUSY %s\n", (char*)NotUsed);
usleep(100);