-C Enable/disable\ssupport.
-D 2011-03-31T15:11:53.959
+C Removed\sdependency\son\ssqliteInt.h\sso\sthat\smultiplex\sVFS\sshim\scan\sbe\scompiled\sas\sloadable\smodule.
+D 2011-04-01T14:22:46.544
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 27701a1653595a1f2187dc61c8117e00a6c1d50f
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/test_journal.c 785edd54f963aefb3c1628124170a56697c68c70
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c fd6188b1501c0010fb4241ddc9f0d5ac402c688d
-F src/test_multiplex.c c0d9450b63b0f785795e4873ce90002414921a61
-F src/test_multiplex.h bf7b2d303688c32cdd1cee3ffdc377f13391e311
+F src/test_multiplex.c fdabd793ee7a9642c5a8a470def2347144c46d05
+F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
-F test/multiplex.test 5373b2c3b0f3e262e746652d8f93b6f6297b15ba
+F test/multiplex.test a88f3e2c16e567e72be7296195c59fbdd6a8d3d4
F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test a44e04df1486fcfb02d32468cbcd3c8e1e433723
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P fee9734c193a8bec9599e02e16938179e642bf5e
-R 9ef3873d6c48b9ead5e6ba118b2bc91f
+P b3c6d9aa9e2124a2f2a1a5f9dbbd7db3b1d01a31
+R 5fdb22cfeb915ca0348434fc3aeb88a3
U shaneh
-Z 53dc1c2b6709916c1194488b48f81a5e
+Z c6a6d5930d83831b14cb5982ae50977b
#include "sqlite3.h"
#include <string.h>
#include <assert.h>
-#include "sqliteInt.h"
#include "test_multiplex.h"
#ifndef SQLITE_CORE
#endif
#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.
*/
/* This is the limit on the chunk size. It may be changed by calling
** 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
** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT
static void multiplexEnter(void){ sqlite3_mutex_enter(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
** the sqlite3_file* for the underlying original VFS.
*/
return NULL;
}
+/*
+** This is the implementation of the multiplex_control() SQL function.
+*/
static void multiplexControlFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
- extern const char *sqlite3TestErrorName(int);
- extern int multiplexFileControl(sqlite3_file *, int, void *);
int rc = SQLITE_OK;
sqlite3 *db = sqlite3_context_db_handle(context);
int op;
op = MULTIPLEX_CTRL_SET_MAX_CHUNKS;
break;
default:
- rc = SQLITE_ERROR;
+ rc = SQLITE_NOTFOUND;
break;
}
}
if( rc==SQLITE_OK ){
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(
sqlite3 *db,
){
int rc;
rc = sqlite3_create_function(db, "multiplex_control", 2, SQLITE_ANY,
- 0, multiplexControlFunc, 0, 0);
+ 0, multiplexControlFunc, 0, 0);
return rc;
}
multiplexGroup *pGroup; /* Corresponding multiplexGroup object */
sqlite3_file *pSubOpen; /* Real file descriptor */
sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */
- int nName = sqlite3Strlen30(zName);
+ int nName = multiplexStrlen30(zName);
int i;
int sz;
multiplexEnter();
pMultiplexOpen = (multiplexConn*)pConn;
/* allocate space for group */
- sz = sizeof(multiplexGroup) /* multiplexGroup */
- + (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS) /* pReal[] */
- + (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS) /* *pReal */
- + SQLITE_MULTIPLEX_MAX_CHUNKS /* bOpen[] */
- + nName + 1; /* zName */
+ sz = sizeof(multiplexGroup) /* multiplexGroup */
+ + (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS) /* pReal[] */
+ + (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS) /* *pReal */
+ + SQLITE_MULTIPLEX_MAX_CHUNKS /* bOpen[] */
+ + nName + 1; /* zName */
#ifndef SQLITE_MULTIPLEX_EXT_OVWR
sz += SQLITE_MULTIPLEX_EXT_SZ;
assert(nName+SQLITE_MULTIPLEX_EXT_SZ < pOrigVfs->mxPathname);
){
sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */
int rc = SQLITE_OK;
- int nName = sqlite3Strlen30(zName);
+ int nName = multiplexStrlen30(zName);
int i;
UNUSED_PARAMETER(pVfs);
int exists = 0;
if( i ){
#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
- 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
}
- 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 it exists, delete it */
rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, syncDir);
pGroup->bOpen[i] = 0;
}
#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
- 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
rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, 0);
if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE;
memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1);
if( i ){
#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
- 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
}
- 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 it exists, open it */
pSubOpen = multiplexSubOpen(p, i, &rc, NULL);
if( nChunkSize<1 ){
rc = SQLITE_MISUSE;
}else{
- /* Round up to nearest multiple of SQLITE_MAX_PAGE_SIZE. */
- nChunkSize = (nChunkSize + (SQLITE_MAX_PAGE_SIZE-1));
- nChunkSize &= ~(SQLITE_MAX_PAGE_SIZE-1);
+ /* Round up to nearest multiple of MAX_PAGE_SIZE. */
+ nChunkSize = (nChunkSize + (MAX_PAGE_SIZE-1));
+ nChunkSize &= ~(MAX_PAGE_SIZE-1);
pGroup->nChunkSize = nChunkSize;
rc = SQLITE_OK;
}
if( pSubOpen ){
return pSubOpen->pMethods->xSectorSize(pSubOpen);
}
- return SQLITE_DEFAULT_SECTOR_SIZE;
+ return DEFAULT_SECTOR_SIZE;
}
/* Pass xDeviceCharacteristics requests through to the original VFS unchanged.
/***************************** Test Code ***********************************/
#ifdef SQLITE_TEST
#include <tcl.h>
+extern const char *sqlite3TestErrorName(int);
/*
do_test multiplex-1.9.9 { db close } {}
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.2 { sqlite3 db test.db } {}
-do_test multiplex-1.10.3 { execsql { SELECT multiplex_control(2, 32768); } } {SQLITE_OK}
-do_test multiplex-1.10.4 { execsql { SELECT multiplex_control(3, -1); } } {SQLITE_MISUSE}
-do_test multiplex-1.10.5 { execsql { SELECT multiplex_control(2, -1); } } {SQLITE_MISUSE}
-do_test multiplex-1.10.6 { execsql { SELECT multiplex_control(2, 31); } } {SQLITE_OK}
-do_test multiplex-1.10.7 { execsql { SELECT multiplex_control(3, 100); } } {SQLITE_MISUSE}
-do_test multiplex-1.10.8 { execsql { SELECT multiplex_control(2, 1073741824); } } {SQLITE_OK}
-do_test multiplex-1.10.9 { db close } {}
-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.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.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.6 { db close } {}
-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.2 { sqlite3 db test.db } {}
-do_test multiplex-1.12.3 { execsql { SELECT multiplex_control(1, 0); } } {SQLITE_OK}
-do_test multiplex-1.12.4 { execsql { SELECT multiplex_control(1, 1); } } {SQLITE_OK}
-do_test multiplex-1.12.5 { execsql { SELECT multiplex_control(1, -1); } } {SQLITE_OK}
-do_test multiplex-1.12.6 { db close } {}
-do_test multiplex-1.12.7 { sqlite3_multiplex_shutdown } {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.3 { lindex [ catchsql { SELECT multiplex_control(2, 32768); } ] 0 } {0}
+do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {1}
+do_test multiplex-1.10.5 { lindex [ catchsql { SELECT multiplex_control(2, -1); } ] 0 } {1}
+do_test multiplex-1.10.6 { lindex [ catchsql { SELECT multiplex_control(2, 31); } ] 0 } {0}
+do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {1}
+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.10 { sqlite3_multiplex_shutdown } {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.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.5 { sqlite3_multiplex_control db main enable -1 } {SQLITE_OK}
+do_test multiplex-1.11.6 { db close } {}
+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.2 { sqlite3 db test.db } {}
+do_test multiplex-1.12.3 { lindex [ catchsql { SELECT multiplex_control(1, 0); } ] 0 } {0}
+do_test multiplex-1.12.4 { lindex [ catchsql { SELECT multiplex_control(1, 1); } ] 0 } {0}
+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.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
}
}
-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.3 { sqlite3 db test.db } {}
-do_test multiplex-2.7.4 { execsql { SELECT multiplex_control(2, 65536); } } {SQLITE_OK}
-do_test multiplex-2.7.5 { execsql { SELECT multiplex_control(1, 0); } } {SQLITE_OK}
+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.3 { sqlite3 db test.db } {}
+do_test multiplex-2.7.4 { lindex [ catchsql { SELECT multiplex_control(2, 65536); } ] 0 } {0}
+do_test multiplex-2.7.5 { lindex [ catchsql { SELECT multiplex_control(1, 0); } ] 0 } {0}
do_test multiplex-2.7.6 {
execsql {
CREATE TABLE t1(a PRIMARY KEY, b);
do_test multiplex-2.7.8 { file exists [multiplex_name test.db 1] } {0}
do_test multiplex-2.7.9 {
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
do_test multiplex-2.7.12 { db close } {}
do_test multiplex-2.7.13 { sqlite3_multiplex_shutdown } {SQLITE_OK}
-
#-------------------------------------------------------------------------
# Try some tests with more than one connection to a database file. Still
# in rollback mode.