1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-22 22:13:04 +03:00

Change sqlite3_busy_timeout so that it checks for an invalid database

pointer. (CVS 3320)

FossilOrigin-Name: 225a9597b21bde7666451fc2eb7695dc35c438bb
This commit is contained in:
drh
2006-07-06 10:59:57 +00:00
parent 72c4d3e7ed
commit 3086765b6f
5 changed files with 52 additions and 12 deletions

View File

@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.216 2006/06/27 20:06:45 drh Exp $
** $Id: test1.c,v 1.217 2006/07/06 10:59:58 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -3230,6 +3230,33 @@ static int get_autocommit(
return TCL_OK;
}
/*
** Usage: sqlite3_busy_timeout DB MS
**
** Set the busy timeout. This is more easily done using the timeout
** method of the TCL interface. But we need a way to test the case
** where it returns SQLITE_MISUSE.
*/
static int test_busy_timeout(
void * clientData,
Tcl_Interp *interp,
int argc,
char **argv
){
int rc, ms;
sqlite3 *db;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" DB", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
if( Tcl_GetInt(interp, argv[2], &ms) ) return TCL_ERROR;
rc = sqlite3_busy_timeout(db, ms);
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
return TCL_OK;
}
/*
** Usage: tcl_variable_type VARIABLENAME
**
@@ -3715,6 +3742,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite_delete_collation", (Tcl_CmdProc*)delete_collation },
{ "sqlite3_get_autocommit", (Tcl_CmdProc*)get_autocommit },
{ "sqlite3_stack_used", (Tcl_CmdProc*)test_stack_used },
{ "sqlite3_busy_timeout", (Tcl_CmdProc*)test_busy_timeout },
};
static struct {
char *zName;