mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
The quick test runs again with a handfull of errors after adding the
mutex locks to btree, the VFS registration interfaces, and FTS3. (CVS 4254) FossilOrigin-Name: 6cf725d212d468cbd7c7cbc22ca5ab13f1d77939
This commit is contained in:
23
src/test3.c
23
src/test3.c
@@ -13,7 +13,7 @@
|
||||
** is not included in the SQLite library. It is used for automated
|
||||
** testing of the SQLite library.
|
||||
**
|
||||
** $Id: test3.c,v 1.78 2007/08/16 11:36:15 danielk1977 Exp $
|
||||
** $Id: test3.c,v 1.79 2007/08/20 23:50:25 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "pager.h"
|
||||
@@ -48,6 +48,13 @@ static char *errorName(int rc){
|
||||
return zName;
|
||||
}
|
||||
|
||||
/*
|
||||
** A bogus sqlite3 connection structure for use in the btree
|
||||
** tests.
|
||||
*/
|
||||
static sqlite3 sDb;
|
||||
static int nRefSqlite3 = 0;
|
||||
|
||||
/*
|
||||
** Usage: btree_open FILENAME NCACHE FLAGS
|
||||
**
|
||||
@@ -69,7 +76,12 @@ static int btree_open(
|
||||
}
|
||||
if( Tcl_GetInt(interp, argv[2], &nCache) ) return TCL_ERROR;
|
||||
if( Tcl_GetInt(interp, argv[3], &flags) ) return TCL_ERROR;
|
||||
rc = sqlite3BtreeOpen(argv[1], 0, &pBt, flags);
|
||||
nRefSqlite3++;
|
||||
if( nRefSqlite3==1 ){
|
||||
sDb.pVfs = sqlite3_vfs_find(0);
|
||||
sDb.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_RECURSIVE);
|
||||
}
|
||||
rc = sqlite3BtreeOpen(argv[1], &sDb, &pBt, flags);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
@@ -104,6 +116,13 @@ static int btree_close(
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
nRefSqlite3--;
|
||||
if( nRefSqlite3==0 ){
|
||||
sqlite3_mutex_free(sDb.mutex);
|
||||
sDb.mutex = 0;
|
||||
sqlite3_vfs_release(sDb.pVfs);
|
||||
sDb.pVfs = 0;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user