1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Removed dependency on sqliteInt.h so that multiplex VFS shim can be compiled as loadable module.

FossilOrigin-Name: 718f1ad7df9115871ba6159012d3183183fc40a1
This commit is contained in:
shaneh
2011-04-01 14:22:46 +00:00
parent c27fa4b074
commit 3801b65d62
5 changed files with 118 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
C Enable/disable\ssupport. C Removed\sdependency\son\ssqliteInt.h\sso\sthat\smultiplex\sVFS\sshim\scan\sbe\scompiled\sas\sloadable\smodule.
D 2011-03-31T15:11:53.959 D 2011-04-01T14:22:46.544
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -209,8 +209,8 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
F src/test_journal.c 785edd54f963aefb3c1628124170a56697c68c70 F src/test_journal.c 785edd54f963aefb3c1628124170a56697c68c70
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c fd6188b1501c0010fb4241ddc9f0d5ac402c688d F src/test_malloc.c fd6188b1501c0010fb4241ddc9f0d5ac402c688d
F src/test_multiplex.c c0d9450b63b0f785795e4873ce90002414921a61 F src/test_multiplex.c fdabd793ee7a9642c5a8a470def2347144c46d05
F src/test_multiplex.h bf7b2d303688c32cdd1cee3ffdc377f13391e311 F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c
@@ -576,7 +576,7 @@ F test/misc5.test 45b2e3ed5f79af2b4f38ae362eaf4c49674575bd
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3 F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33 F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
F test/multiplex.test 5373b2c3b0f3e262e746652d8f93b6f6297b15ba F test/multiplex.test a88f3e2c16e567e72be7296195c59fbdd6a8d3d4
F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41 F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test a44e04df1486fcfb02d32468cbcd3c8e1e433723 F test/nan.test a44e04df1486fcfb02d32468cbcd3c8e1e433723
@@ -914,7 +914,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P fee9734c193a8bec9599e02e16938179e642bf5e P b3c6d9aa9e2124a2f2a1a5f9dbbd7db3b1d01a31
R 9ef3873d6c48b9ead5e6ba118b2bc91f R 5fdb22cfeb915ca0348434fc3aeb88a3
U shaneh U shaneh
Z 53dc1c2b6709916c1194488b48f81a5e Z c6a6d5930d83831b14cb5982ae50977b

View File

@@ -1 +1 @@
b3c6d9aa9e2124a2f2a1a5f9dbbd7db3b1d01a31 718f1ad7df9115871ba6159012d3183183fc40a1

View File

@@ -22,7 +22,6 @@
#include "sqlite3.h" #include "sqlite3.h"
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "sqliteInt.h"
#include "test_multiplex.h" #include "test_multiplex.h"
#ifndef SQLITE_CORE #ifndef SQLITE_CORE
@@ -30,6 +29,16 @@
#endif #endif
#include "sqlite3ext.h" #include "sqlite3ext.h"
/*
** These should be defined to be the same as the values in
** sqliteInt.h. They are defined seperately here so that
** the multiplex VFS shim can be built as a loadable
** module.
*/
#define UNUSED_PARAMETER(x) (void)(x)
#define MAX_PAGE_SIZE 0x10000
#define DEFAULT_SECTOR_SIZE 0x1000
/* /*
** For a build without mutexes, no-op the mutex calls. ** For a build without mutexes, no-op the mutex calls.
*/ */
@@ -50,9 +59,9 @@
/* This is the limit on the chunk size. It may be changed by calling /* This is the limit on the chunk size. It may be changed by calling
** the xFileControl() interface. It will be rounded up to a ** the xFileControl() interface. It will be rounded up to a
** multiple of SQLITE_MAX_PAGE_SIZE. We default it here to 1GB. ** multiple of MAX_PAGE_SIZE. We default it here to 1GB.
*/ */
#define SQLITE_MULTIPLEX_CHUNK_SIZE (SQLITE_MAX_PAGE_SIZE*16384) #define SQLITE_MULTIPLEX_CHUNK_SIZE (MAX_PAGE_SIZE*16384)
/* Default limit on number of chunks. Care should be taken /* Default limit on number of chunks. Care should be taken
** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT ** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT
@@ -168,6 +177,21 @@ static struct {
static void multiplexEnter(void){ sqlite3_mutex_enter(gMultiplex.pMutex); } static void multiplexEnter(void){ sqlite3_mutex_enter(gMultiplex.pMutex); }
static void multiplexLeave(void){ sqlite3_mutex_leave(gMultiplex.pMutex); } static void multiplexLeave(void){ sqlite3_mutex_leave(gMultiplex.pMutex); }
/*
** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer.
**
** The value returned will never be negative. Nor will it ever be greater
** than the actual length of the string. For very long strings (greater
** than 1GiB) the value returned might be less than the true string length.
*/
int multiplexStrlen30(const char *z){
const char *z2 = z;
if( z==0 ) return 0;
while( *z2 ){ z2++; }
return 0x3fffffff & (int)(z2 - z);
}
/* Translate an sqlite3_file* that is really a multiplexGroup* into /* Translate an sqlite3_file* that is really a multiplexGroup* into
** the sqlite3_file* for the underlying original VFS. ** the sqlite3_file* for the underlying original VFS.
*/ */
@@ -199,13 +223,14 @@ static sqlite3_file *multiplexSubOpen(multiplexConn *pConn, int iChunk, int *rc,
return NULL; return NULL;
} }
/*
** This is the implementation of the multiplex_control() SQL function.
*/
static void multiplexControlFunc( static void multiplexControlFunc(
sqlite3_context *context, sqlite3_context *context,
int argc, int argc,
sqlite3_value **argv sqlite3_value **argv
){ ){
extern const char *sqlite3TestErrorName(int);
extern int multiplexFileControl(sqlite3_file *, int, void *);
int rc = SQLITE_OK; int rc = SQLITE_OK;
sqlite3 *db = sqlite3_context_db_handle(context); sqlite3 *db = sqlite3_context_db_handle(context);
int op; int op;
@@ -229,18 +254,19 @@ static void multiplexControlFunc(
op = MULTIPLEX_CTRL_SET_MAX_CHUNKS; op = MULTIPLEX_CTRL_SET_MAX_CHUNKS;
break; break;
default: default:
rc = SQLITE_ERROR; rc = SQLITE_NOTFOUND;
break; break;
} }
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_file_control(db, 0, op, &iVal); rc = sqlite3_file_control(db, 0, op, &iVal);
} }
sqlite3_result_text(context, (char *)sqlite3TestErrorName(rc), -1, SQLITE_TRANSIENT); sqlite3_result_error_code(context, rc);
} }
/* /*
** This is the entry point to register the auto-extension for the multiplex_control() function. ** This is the entry point to register the auto-extension for the
** multiplex_control() function.
*/ */
static int multiplexFuncInit( static int multiplexFuncInit(
sqlite3 *db, sqlite3 *db,
@@ -249,7 +275,7 @@ static int multiplexFuncInit(
){ ){
int rc; int rc;
rc = sqlite3_create_function(db, "multiplex_control", 2, SQLITE_ANY, rc = sqlite3_create_function(db, "multiplex_control", 2, SQLITE_ANY,
0, multiplexControlFunc, 0, 0); 0, multiplexControlFunc, 0, 0);
return rc; return rc;
} }
@@ -274,7 +300,7 @@ static int multiplexOpen(
multiplexGroup *pGroup; /* Corresponding multiplexGroup object */ multiplexGroup *pGroup; /* Corresponding multiplexGroup object */
sqlite3_file *pSubOpen; /* Real file descriptor */ sqlite3_file *pSubOpen; /* Real file descriptor */
sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */
int nName = sqlite3Strlen30(zName); int nName = multiplexStrlen30(zName);
int i; int i;
int sz; int sz;
@@ -286,11 +312,11 @@ static int multiplexOpen(
multiplexEnter(); multiplexEnter();
pMultiplexOpen = (multiplexConn*)pConn; pMultiplexOpen = (multiplexConn*)pConn;
/* allocate space for group */ /* allocate space for group */
sz = sizeof(multiplexGroup) /* multiplexGroup */ sz = sizeof(multiplexGroup) /* multiplexGroup */
+ (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS) /* pReal[] */ + (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS) /* pReal[] */
+ (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS) /* *pReal */ + (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS) /* *pReal */
+ SQLITE_MULTIPLEX_MAX_CHUNKS /* bOpen[] */ + SQLITE_MULTIPLEX_MAX_CHUNKS /* bOpen[] */
+ nName + 1; /* zName */ + nName + 1; /* zName */
#ifndef SQLITE_MULTIPLEX_EXT_OVWR #ifndef SQLITE_MULTIPLEX_EXT_OVWR
sz += SQLITE_MULTIPLEX_EXT_SZ; sz += SQLITE_MULTIPLEX_EXT_SZ;
assert(nName+SQLITE_MULTIPLEX_EXT_SZ < pOrigVfs->mxPathname); assert(nName+SQLITE_MULTIPLEX_EXT_SZ < pOrigVfs->mxPathname);
@@ -362,7 +388,7 @@ static int multiplexDelete(
){ ){
sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */
int rc = SQLITE_OK; int rc = SQLITE_OK;
int nName = sqlite3Strlen30(zName); int nName = multiplexStrlen30(zName);
int i; int i;
UNUSED_PARAMETER(pVfs); UNUSED_PARAMETER(pVfs);
@@ -374,12 +400,17 @@ static int multiplexDelete(
int exists = 0; int exists = 0;
if( i ){ if( i ){
#ifdef SQLITE_MULTIPLEX_EXT_OVWR #ifdef SQLITE_MULTIPLEX_EXT_OVWR
sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+nName-SQLITE_MULTIPLEX_EXT_SZ, SQLITE_MULTIPLEX_EXT_FMT, i); sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
gMultiplex.zName+nName-SQLITE_MULTIPLEX_EXT_SZ,
SQLITE_MULTIPLEX_EXT_FMT, i);
#else #else
sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+nName, SQLITE_MULTIPLEX_EXT_FMT, i); sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
gMultiplex.zName+nName,
SQLITE_MULTIPLEX_EXT_FMT, i);
#endif #endif
} }
rc2 = pOrigVfs->xAccess(pOrigVfs, gMultiplex.zName, SQLITE_ACCESS_EXISTS, &exists); rc2 = pOrigVfs->xAccess(pOrigVfs, gMultiplex.zName,
SQLITE_ACCESS_EXISTS, &exists);
if( rc2==SQLITE_OK && exists){ if( rc2==SQLITE_OK && exists){
/* if it exists, delete it */ /* if it exists, delete it */
rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, syncDir); rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, syncDir);
@@ -569,9 +600,13 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){
pGroup->bOpen[i] = 0; pGroup->bOpen[i] = 0;
} }
#ifdef SQLITE_MULTIPLEX_EXT_OVWR #ifdef SQLITE_MULTIPLEX_EXT_OVWR
sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, SQLITE_MULTIPLEX_EXT_FMT, i); sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ,
SQLITE_MULTIPLEX_EXT_FMT, i);
#else #else
sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName, SQLITE_MULTIPLEX_EXT_FMT, i); sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
gMultiplex.zName+pGroup->nName,
SQLITE_MULTIPLEX_EXT_FMT, i);
#endif #endif
rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, 0); rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, 0);
if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE; if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE;
@@ -634,12 +669,17 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){
memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1); memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1);
if( i ){ if( i ){
#ifdef SQLITE_MULTIPLEX_EXT_OVWR #ifdef SQLITE_MULTIPLEX_EXT_OVWR
sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, SQLITE_MULTIPLEX_EXT_FMT, i); sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ,
SQLITE_MULTIPLEX_EXT_FMT, i);
#else #else
sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName, SQLITE_MULTIPLEX_EXT_FMT, i); sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1,
gMultiplex.zName+pGroup->nName,
SQLITE_MULTIPLEX_EXT_FMT, i);
#endif #endif
} }
rc2 = pOrigVfs->xAccess(pOrigVfs, gMultiplex.zName, SQLITE_ACCESS_EXISTS, &exists); rc2 = pOrigVfs->xAccess(pOrigVfs, gMultiplex.zName,
SQLITE_ACCESS_EXISTS, &exists);
if( rc2==SQLITE_OK && exists){ if( rc2==SQLITE_OK && exists){
/* if it exists, open it */ /* if it exists, open it */
pSubOpen = multiplexSubOpen(p, i, &rc, NULL); pSubOpen = multiplexSubOpen(p, i, &rc, NULL);
@@ -728,9 +768,9 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){
if( nChunkSize<1 ){ if( nChunkSize<1 ){
rc = SQLITE_MISUSE; rc = SQLITE_MISUSE;
}else{ }else{
/* Round up to nearest multiple of SQLITE_MAX_PAGE_SIZE. */ /* Round up to nearest multiple of MAX_PAGE_SIZE. */
nChunkSize = (nChunkSize + (SQLITE_MAX_PAGE_SIZE-1)); nChunkSize = (nChunkSize + (MAX_PAGE_SIZE-1));
nChunkSize &= ~(SQLITE_MAX_PAGE_SIZE-1); nChunkSize &= ~(MAX_PAGE_SIZE-1);
pGroup->nChunkSize = nChunkSize; pGroup->nChunkSize = nChunkSize;
rc = SQLITE_OK; rc = SQLITE_OK;
} }
@@ -771,7 +811,7 @@ static int multiplexSectorSize(sqlite3_file *pConn){
if( pSubOpen ){ if( pSubOpen ){
return pSubOpen->pMethods->xSectorSize(pSubOpen); return pSubOpen->pMethods->xSectorSize(pSubOpen);
} }
return SQLITE_DEFAULT_SECTOR_SIZE; return DEFAULT_SECTOR_SIZE;
} }
/* Pass xDeviceCharacteristics requests through to the original VFS unchanged. /* Pass xDeviceCharacteristics requests through to the original VFS unchanged.
@@ -941,6 +981,7 @@ int sqlite3_multiplex_shutdown(void){
/***************************** Test Code ***********************************/ /***************************** Test Code ***********************************/
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
#include <tcl.h> #include <tcl.h>
extern const char *sqlite3TestErrorName(int);
/* /*

View File

@@ -60,16 +60,16 @@
** function gives access to the xFileControl interface of the ** function gives access to the xFileControl interface of the
** multiplex VFS shim. ** multiplex VFS shim.
** **
** SELECT multiplex_control(<op>,<val>) ; ** SELECT multiplex_control(<op>,<val>);
** **
** <op>=1 MULTIPLEX_CTRL_ENABLE ** <op>=1 MULTIPLEX_CTRL_ENABLE
** <val>=0 disable ** <val>=0 disable
** <val>=1 enable ** <val>=1 enable
** **
** <op>=1 MULTIPLEX_CTRL_SET_CHUNK_SIZE ** <op>=2 MULTIPLEX_CTRL_SET_CHUNK_SIZE
** <val> int, chunk size ** <val> int, chunk size
** **
** <op>=1 MULTIPLEX_CTRL_SET_MAX_CHUNKS ** <op>=3 MULTIPLEX_CTRL_SET_MAX_CHUNKS
** <val> int, max chunks ** <val> int, max chunks
** **
** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once ** THIS ROUTINE IS NOT THREADSAFE. Call this routine exactly once

View File

@@ -86,32 +86,39 @@ do_test multiplex-1.9.8 { multiplex_set db main 1073741824 1 } {SQLITE_OK}
do_test multiplex-1.9.9 { db close } {} do_test multiplex-1.9.9 { db close } {}
do_test multiplex-1.9.10 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.9.10 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.10.2 { sqlite3 db test.db } {} do_test multiplex-1.10.2 { sqlite3 db test.db } {}
do_test multiplex-1.10.3 { execsql { SELECT multiplex_control(2, 32768); } } {SQLITE_OK} do_test multiplex-1.10.3 { lindex [ catchsql { SELECT multiplex_control(2, 32768); } ] 0 } {0}
do_test multiplex-1.10.4 { execsql { SELECT multiplex_control(3, -1); } } {SQLITE_MISUSE} do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {1}
do_test multiplex-1.10.5 { execsql { SELECT multiplex_control(2, -1); } } {SQLITE_MISUSE} do_test multiplex-1.10.5 { lindex [ catchsql { SELECT multiplex_control(2, -1); } ] 0 } {1}
do_test multiplex-1.10.6 { execsql { SELECT multiplex_control(2, 31); } } {SQLITE_OK} do_test multiplex-1.10.6 { lindex [ catchsql { SELECT multiplex_control(2, 31); } ] 0 } {0}
do_test multiplex-1.10.7 { execsql { SELECT multiplex_control(3, 100); } } {SQLITE_MISUSE} do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {1}
do_test multiplex-1.10.8 { execsql { SELECT multiplex_control(2, 1073741824); } } {SQLITE_OK} do_test multiplex-1.10.8 { lindex [ catchsql { SELECT multiplex_control(2, 1073741824); } ] 0 } {0}
do_test multiplex-1.10.9 { db close } {} do_test multiplex-1.10.9 { db close } {}
do_test multiplex-1.10.10 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.10.10 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.11.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.11.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.11.2 { sqlite3 db test.db } {} do_test multiplex-1.11.2 { sqlite3 db test.db } {}
do_test multiplex-1.11.3 { sqlite3_multiplex_control db main enable 0 } {SQLITE_OK} do_test multiplex-1.11.3 { sqlite3_multiplex_control db main enable 0 } {SQLITE_OK}
do_test multiplex-1.11.4 { sqlite3_multiplex_control db main enable 1 } {SQLITE_OK} do_test multiplex-1.11.4 { sqlite3_multiplex_control db main enable 1 } {SQLITE_OK}
do_test multiplex-1.11.5 { sqlite3_multiplex_control db main enable -1 } {SQLITE_OK} do_test multiplex-1.11.5 { sqlite3_multiplex_control db main enable -1 } {SQLITE_OK}
do_test multiplex-1.11.6 { db close } {} do_test multiplex-1.11.6 { db close } {}
do_test multiplex-1.11.7 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.11.7 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.12.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.12.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.12.2 { sqlite3 db test.db } {} do_test multiplex-1.12.2 { sqlite3 db test.db } {}
do_test multiplex-1.12.3 { execsql { SELECT multiplex_control(1, 0); } } {SQLITE_OK} do_test multiplex-1.12.3 { lindex [ catchsql { SELECT multiplex_control(1, 0); } ] 0 } {0}
do_test multiplex-1.12.4 { execsql { SELECT multiplex_control(1, 1); } } {SQLITE_OK} do_test multiplex-1.12.4 { lindex [ catchsql { SELECT multiplex_control(1, 1); } ] 0 } {0}
do_test multiplex-1.12.5 { execsql { SELECT multiplex_control(1, -1); } } {SQLITE_OK} do_test multiplex-1.12.5 { lindex [ catchsql { SELECT multiplex_control(1, -1); } ] 0 } {0}
do_test multiplex-1.12.6 { db close } {} do_test multiplex-1.12.6 { db close } {}
do_test multiplex-1.12.7 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.12.7 { sqlite3_multiplex_shutdown } {SQLITE_OK}
do_test multiplex-1.13.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-1.13.2 { sqlite3 db test.db } {}
do_test multiplex-1.13.3 { lindex [ catchsql { SELECT multiplex_control(-1, 0); } ] 0 } {1}
do_test multiplex-1.13.4 { lindex [ catchsql { SELECT multiplex_control(4, 1); } ] 0 } {1}
do_test multiplex-1.13.6 { db close } {}
do_test multiplex-1.13.7 { sqlite3_multiplex_shutdown } {SQLITE_OK}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Some simple warm-body tests with a single database file in rollback # Some simple warm-body tests with a single database file in rollback
@@ -283,11 +290,11 @@ foreach jmode $all_journal_modes {
} }
} }
do_test multiplex-2.7.1 { multiplex_delete test.db } {} do_test multiplex-2.7.1 { multiplex_delete test.db } {}
do_test multiplex-2.7.2 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-2.7.2 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK}
do_test multiplex-2.7.3 { sqlite3 db test.db } {} do_test multiplex-2.7.3 { sqlite3 db test.db } {}
do_test multiplex-2.7.4 { execsql { SELECT multiplex_control(2, 65536); } } {SQLITE_OK} do_test multiplex-2.7.4 { lindex [ catchsql { SELECT multiplex_control(2, 65536); } ] 0 } {0}
do_test multiplex-2.7.5 { execsql { SELECT multiplex_control(1, 0); } } {SQLITE_OK} do_test multiplex-2.7.5 { lindex [ catchsql { SELECT multiplex_control(1, 0); } ] 0 } {0}
do_test multiplex-2.7.6 { do_test multiplex-2.7.6 {
execsql { execsql {
CREATE TABLE t1(a PRIMARY KEY, b); CREATE TABLE t1(a PRIMARY KEY, b);
@@ -299,7 +306,7 @@ do_test multiplex-2.7.7 { expr ([file size [multiplex_name test.db 0]] < 65536)
do_test multiplex-2.7.8 { file exists [multiplex_name test.db 1] } {0} do_test multiplex-2.7.8 { file exists [multiplex_name test.db 1] } {0}
do_test multiplex-2.7.9 { do_test multiplex-2.7.9 {
execsql { execsql {
INSERT INTO t1 VALUES(1, randomblob(65536)); INSERT INTO t1 VALUES(2, randomblob(65536));
} }
} {} } {}
# verify only one file, and file size exceeds chunks size # verify only one file, and file size exceeds chunks size
@@ -308,7 +315,6 @@ do_test multiplex-2.7.11 { file exists [multiplex_name test.db 1] }
do_test multiplex-2.7.12 { db close } {} do_test multiplex-2.7.12 { db close } {}
do_test multiplex-2.7.13 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-2.7.13 { sqlite3_multiplex_shutdown } {SQLITE_OK}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Try some tests with more than one connection to a database file. Still # Try some tests with more than one connection to a database file. Still
# in rollback mode. # in rollback mode.