Merge the nx-devkit changes into trunk. This includes the new
SQLITE_FCNTL_VFSNAME file-control. FossilOrigin-Name: da118e02c0576ce16f7a26663f59413316223d55
This commit is contained in:
commit
a60ef3d570
36
manifest
36
manifest
@ -1,5 +1,5 @@
|
||||
C Treat\sa\szero\sreturn\svalue\sfrom\sthe\sWin32\sAPIs\sMultiByteToWideChar\sand\sWideCharToMultiByte\sas\san\serror\scondition.
|
||||
D 2011-12-14T00:37:45.399
|
||||
C Merge\sthe\snx-devkit\schanges\sinto\strunk.\s\sThis\sincludes\sthe\snew\nSQLITE_FCNTL_VFSNAME\sfile-control.
|
||||
D 2011-12-14T18:33:13.731
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -147,7 +147,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
|
||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||
F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
|
||||
F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
|
||||
F src/main.c b4c74ff20abd393b14b3cf7b2130758e2187a5b2
|
||||
F src/main.c c837e24182e8ec7121c61e44f547b59cbe413e7f
|
||||
F src/malloc.c 591aedb20ae40813f1045f2ef253438a334775d9
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 7998e7003a3047e323c849a26dda004debc04d03
|
||||
@ -166,8 +166,8 @@ F src/os.c 28bbdab2170dfce84d86c45456a18eab1d0f99a9
|
||||
F src/os.h 549b1a2e5e0ed1e1499f252dac126c4973e7379c
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||
F src/os_unix.c dcb42d74044efcf760c3c03c668e9e7314aa2427
|
||||
F src/os_win.c 745cfae00e887ba90452f7ef2a245272c4ed7374
|
||||
F src/os_unix.c 7dc7df10331942b139032328449a3723e051979e
|
||||
F src/os_win.c 197d23ce8a0dff748e766e034bf95ff756dd3884
|
||||
F src/pager.c d981f3bfcc0e4460537d983899620700ccf8f539
|
||||
F src/pager.h 5cd760857707529b403837d813d86b68938d6183
|
||||
F src/parse.y fabb2e7047417d840e6fdb3ef0988a86849a08ba
|
||||
@ -181,15 +181,15 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
||||
F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40
|
||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||
F src/select.c a1d075db66a0ea42807353501b62997969e5be79
|
||||
F src/shell.c ea9c11ae5dbe32b9f0a779b96f6b351293b8e638
|
||||
F src/sqlite.h.in 1dc07194eb1a2c69c8ef75f88022b170be08024a
|
||||
F src/shell.c aa4183d4a5243d8110b1d3d77faa4aea7e9c9c2d
|
||||
F src/sqlite.h.in e3e45b5c69ab3236c7ec4591a5858221863cecd4
|
||||
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
|
||||
F src/sqliteInt.h 165409fa8adc8701148830804febeded3f2e4448
|
||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
F src/status.c 4568e72dfd36b6a5911f93457364deb072e0b03a
|
||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||
F src/tclsqlite.c de581e2e71f5e7f98366156afad83b4742ac6fe0
|
||||
F src/test1.c fe455fc1be1b0dbf4ce45b11c255900e8ae18da3
|
||||
F src/test1.c 33b9c49f728cf28937eea7b246c28e89e3cf5e9e
|
||||
F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
|
||||
F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
|
||||
F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
|
||||
@ -214,13 +214,13 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207
|
||||
F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff
|
||||
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
|
||||
F src/test_malloc.c 8d416f29ad8573f32601f6056c9d2b17472e9ad5
|
||||
F src/test_multiplex.c 10aaf8b7ebeb74f82d5c96e06c398b776917e457
|
||||
F src/test_multiplex.c 80677a47c75ca6a035d1ac66fb59186ffd4cdd19
|
||||
F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
|
||||
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
|
||||
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
|
||||
F src/test_osinst.c 62b0b8ef21ce754cc94e17bb42377ed8795dba32
|
||||
F src/test_osinst.c 6abf0a37ce831120c4ef1b913afdd813e7ac1a73
|
||||
F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
|
||||
F src/test_quota.c a391c866217e92986c6f523f05b08aa6956c8419
|
||||
F src/test_quota.c ec7d1056936f69be953c343bcb480305ce8928f3
|
||||
F src/test_rtree.c 6d06306e29946dc36f528a3a2cdc3add794656f1
|
||||
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
||||
F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
|
||||
@ -230,7 +230,7 @@ F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
|
||||
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
||||
F src/test_thread.c 35022393dd54d147b998b6b7f7e945b01114d666
|
||||
F src/test_vfs.c 27b7d9de40630f603b9e2cf9ef2a7c81d31c4515
|
||||
F src/test_vfstrace.c 0b884e06094a746da729119a2cabdc7aa790063d
|
||||
F src/test_vfstrace.c 065c7270a614254b2c68fbc7ba8d1fb1d5cbc823
|
||||
F src/test_wholenumber.c 6129adfbe7c7444f2e60cc785927f3aa74e12290
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/tokenize.c c819d9f72168a035d545a5bdafe9b085b20df705
|
||||
@ -607,7 +607,7 @@ F test/misc7.test eafaa41b9133d7a2ded4641bbe5f340731d35a52
|
||||
F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054
|
||||
F test/multiplex.test 8bc3c71f73fe833bc8a659d454d320044a33b5da
|
||||
F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
|
||||
F test/multiplex3.test cbc0d03da5fcd0c18a33a8973ef1df1b4bc2100a
|
||||
F test/multiplex3.test 15903c343f1eaa4b00998b7ceacfc4987e4ccfe9
|
||||
F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41
|
||||
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
|
||||
F test/nan.test e9648b9d007c7045242af35e11a984d4b169443a
|
||||
@ -635,7 +635,7 @@ F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
|
||||
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
|
||||
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
|
||||
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
|
||||
F test/quota.test 1c59a396e8f7b5d8466fa74b59f2aeb778d74f7a
|
||||
F test/quota.test e09a01ec974e04a2c4f1c7615005722725b5e131
|
||||
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
|
||||
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
|
||||
F test/randexpr1.test 1084050991e9ba22c1c10edd8d84673b501cc25a
|
||||
@ -980,7 +980,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
P 03a70c3dae8d912fccd9d72c575dc372b198d238
|
||||
R 29870a4086be96ebc531e67fe7235bdd
|
||||
U mistachkin
|
||||
Z fc2bb105d27bbafb8656bcd186800dc4
|
||||
P c65e5a36f1a1c91cb3415158ebe0f5759cbcdf96 08c1dc517c1340737a55ad9012b7b06f72899c6f
|
||||
R 2cdc49e30cc728bae752e402fff2c131
|
||||
U drh
|
||||
Z 5856c8e102de685918e2741a72465352
|
||||
|
@ -1 +1 @@
|
||||
c65e5a36f1a1c91cb3415158ebe0f5759cbcdf96
|
||||
da118e02c0576ce16f7a26663f59413316223d55
|
@ -239,8 +239,8 @@ int sqlite3_initialize(void){
|
||||
*/
|
||||
#ifdef SQLITE_EXTRA_INIT
|
||||
if( rc==SQLITE_OK && sqlite3GlobalConfig.isInit ){
|
||||
int SQLITE_EXTRA_INIT(void);
|
||||
rc = SQLITE_EXTRA_INIT();
|
||||
int SQLITE_EXTRA_INIT(const char*);
|
||||
rc = SQLITE_EXTRA_INIT(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -206,6 +206,7 @@ struct UnixUnusedFd {
|
||||
typedef struct unixFile unixFile;
|
||||
struct unixFile {
|
||||
sqlite3_io_methods const *pMethod; /* Always the first entry */
|
||||
sqlite3_vfs *pVfs; /* The VFS that created this unixFile */
|
||||
unixInodeInfo *pInode; /* Info about locks on this inode */
|
||||
int h; /* The file descriptor */
|
||||
unsigned char eFileLock; /* The type of lock held on this fd */
|
||||
@ -3533,6 +3534,10 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
case SQLITE_FCNTL_VFSNAME: {
|
||||
*(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
/* The pager calls this method to signal that it has done
|
||||
** a rollback and that the database is therefore unchanged and
|
||||
@ -4560,6 +4565,7 @@ static int fillInUnixFile(
|
||||
|
||||
OSTRACE(("OPEN %-3d %s\n", h, zFilename));
|
||||
pNew->h = h;
|
||||
pNew->pVfs = pVfs;
|
||||
pNew->zPath = zFilename;
|
||||
if( memcmp(pVfs->zName,"unix-excl",10)==0 ){
|
||||
pNew->ctrlFlags = UNIXFILE_EXCL;
|
||||
|
@ -2168,6 +2168,10 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
case SQLITE_FCNTL_VFSNAME: {
|
||||
*(char**)pArg = sqlite3_mprintf("win32");
|
||||
return SQLITE_OK;
|
||||
}
|
||||
case SQLITE_FCNTL_SYNC_OMITTED: {
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
13
src/shell.c
13
src/shell.c
@ -1405,6 +1405,7 @@ static char zHelp[] =
|
||||
" If TABLE specified, only list tables matching\n"
|
||||
" LIKE pattern TABLE.\n"
|
||||
".timeout MS Try opening locked tables for MS milliseconds\n"
|
||||
".vfsname ?AUX? Print the name of the VFS stack\n"
|
||||
".width NUM1 NUM2 ... Set column widths for \"column\" mode\n"
|
||||
;
|
||||
|
||||
@ -2348,6 +2349,18 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
sqlite3_libversion(), sqlite3_sourceid());
|
||||
}else
|
||||
|
||||
if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
|
||||
const char *zDbName = nArg==2 ? azArg[1] : "main";
|
||||
char *zVfsName = 0;
|
||||
if( p->db ){
|
||||
sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName);
|
||||
if( zVfsName ){
|
||||
printf("%s\n", zVfsName);
|
||||
sqlite3_free(zVfsName);
|
||||
}
|
||||
}
|
||||
}else
|
||||
|
||||
if( c=='w' && strncmp(azArg[0], "width", n)==0 && nArg>1 ){
|
||||
int j;
|
||||
assert( nArg<=ArraySize(azArg) );
|
||||
|
@ -771,6 +771,17 @@ struct sqlite3_io_methods {
|
||||
** a write transaction to indicate that, unless it is rolled back for some
|
||||
** reason, the entire database file will be overwritten by the current
|
||||
** transaction. This is used by VACUUM operations.
|
||||
**
|
||||
** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
|
||||
** all [VFSes] in the VFS stack. The names are of all VFS shims and the
|
||||
** final bottom-level VFS are written into memory obtained from
|
||||
** [sqlite3_malloc()] and the result is stored in the char* variable
|
||||
** that the fourth parameter of [sqlite3_file_control()] points to.
|
||||
** The caller is responsible for freeing the memory when done. As with
|
||||
** all file-control actions, there is no guarantee that this will actually
|
||||
** do anything. Callers should initialize the char* variable to a NULL
|
||||
** pointer in case this file-control is not implemented. This file-control
|
||||
** is intended for diagnostic use only.
|
||||
*/
|
||||
#define SQLITE_FCNTL_LOCKSTATE 1
|
||||
#define SQLITE_GET_LOCKPROXYFILE 2
|
||||
@ -783,6 +794,7 @@ struct sqlite3_io_methods {
|
||||
#define SQLITE_FCNTL_WIN32_AV_RETRY 9
|
||||
#define SQLITE_FCNTL_PERSIST_WAL 10
|
||||
#define SQLITE_FCNTL_OVERWRITE 11
|
||||
#define SQLITE_FCNTL_VFSNAME 12
|
||||
|
||||
/*
|
||||
** CAPI3REF: Mutex Handle
|
||||
|
34
src/test1.c
34
src/test1.c
@ -5236,6 +5236,39 @@ static int file_control_persist_wal(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** tclcmd: file_control_vfsname DB ?AUXDB?
|
||||
**
|
||||
** Return a string that describes the stack of VFSes.
|
||||
*/
|
||||
static int file_control_vfsname(
|
||||
ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||
){
|
||||
sqlite3 *db;
|
||||
const char *zDbName = "main";
|
||||
char *zVfsName = 0;
|
||||
|
||||
if( objc!=2 && objc!=3 ){
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"",
|
||||
Tcl_GetStringFromObj(objv[0], 0), " DB ?AUXDB?", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( objc==3 ){
|
||||
zDbName = Tcl_GetString(objv[2]);
|
||||
}
|
||||
sqlite3_file_control(db, zDbName, SQLITE_FCNTL_VFSNAME,(void*)&zVfsName);
|
||||
Tcl_AppendResult(interp, zVfsName, (char*)0);
|
||||
sqlite3_free(zVfsName);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** tclcmd: sqlite3_vfs_list
|
||||
**
|
||||
@ -6060,6 +6093,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
{ "file_control_sizehint_test", file_control_sizehint_test, 0 },
|
||||
{ "file_control_win32_av_retry", file_control_win32_av_retry, 0 },
|
||||
{ "file_control_persist_wal", file_control_persist_wal, 0 },
|
||||
{ "file_control_vfsname", file_control_vfsname, 0 },
|
||||
{ "sqlite3_vfs_list", vfs_list, 0 },
|
||||
{ "sqlite3_create_function_v2", test_create_function_v2, 0 },
|
||||
|
||||
|
@ -81,6 +81,9 @@
|
||||
#define sqlite3_mutex_notheld(X) ((void)(X),1)
|
||||
#endif /* SQLITE_THREADSAFE==0 */
|
||||
|
||||
/* First chunk for rollback journal files */
|
||||
#define SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET 400
|
||||
|
||||
|
||||
/************************ Shim Definitions ******************************/
|
||||
|
||||
@ -97,7 +100,7 @@
|
||||
#endif
|
||||
|
||||
/* This used to be the default limit on number of chunks, but
|
||||
** it is no longer enforced. There is currently no limit to the
|
||||
** it is no longer enforced. There is currently no limit to the
|
||||
** number of chunks.
|
||||
**
|
||||
** May be changed by calling the xFileControl() interface.
|
||||
@ -241,10 +244,10 @@ static int multiplexSubFilename(multiplexGroup *pGroup, int iChunk){
|
||||
if( i>=n-4 ) n = i+1;
|
||||
if( pGroup->flags & (SQLITE_OPEN_MAIN_JOURNAL|SQLITE_OPEN_TEMP_JOURNAL) ){
|
||||
/* The extensions on overflow files for main databases are 001, 002,
|
||||
** 003 and so forth. To avoid name collisions, add 100 to the
|
||||
** extensions of journal files so that they are 101, 102, 103, ....
|
||||
** 003 and so forth. To avoid name collisions, add 400 to the
|
||||
** extensions of journal files so that they are 401, 402, 403, ....
|
||||
*/
|
||||
iChunk += 100;
|
||||
iChunk += SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET;
|
||||
}
|
||||
#endif
|
||||
sqlite3_snprintf(4,&z[n],"%03d",iChunk);
|
||||
@ -264,6 +267,18 @@ static sqlite3_file *multiplexSubOpen(
|
||||
){
|
||||
sqlite3_file *pSubOpen = 0;
|
||||
sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */
|
||||
|
||||
#ifdef SQLITE_ENABLE_8_3_NAMES
|
||||
/* If JOURNAL_8_3_OFFSET is set to (say) 400, then any overflow files are
|
||||
** part of a database journal are named db.401, db.402, and so on. A
|
||||
** database may therefore not grow to larger than 400 chunks. Attempting
|
||||
** to open chunk 401 indicates the database is full. */
|
||||
if( iChunk>=SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET ){
|
||||
*rc = SQLITE_FULL;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
*rc = multiplexSubFilename(pGroup, iChunk);
|
||||
if( (*rc)==SQLITE_OK && (pSubOpen = pGroup->aReal[iChunk].p)==0 ){
|
||||
pSubOpen = sqlite3_malloc( pOrigVfs->szOsFile );
|
||||
@ -455,7 +470,7 @@ static int multiplexOpen(
|
||||
sqlite3_int64 sz;
|
||||
|
||||
rc2 = pSubOpen->pMethods->xFileSize(pSubOpen, &sz);
|
||||
if( rc2==SQLITE_OK ){
|
||||
if( rc2==SQLITE_OK && zName ){
|
||||
/* If the first overflow file exists and if the size of the main file
|
||||
** is different from the chunk size, that means the chunk size is set
|
||||
** set incorrectly. So fix it.
|
||||
@ -633,7 +648,7 @@ static int multiplexWrite(
|
||||
rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst);
|
||||
}
|
||||
}else{
|
||||
while( iAmt > 0 ){
|
||||
while( rc==SQLITE_OK && iAmt>0 ){
|
||||
int i = (int)(iOfst / pGroup->szChunk);
|
||||
sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL);
|
||||
if( pSubOpen ){
|
||||
@ -643,13 +658,9 @@ static int multiplexWrite(
|
||||
iAmt -= extra;
|
||||
rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt,
|
||||
iOfst % pGroup->szChunk);
|
||||
if( rc!=SQLITE_OK ) break;
|
||||
pBuf = (char *)pBuf + iAmt;
|
||||
iOfst += iAmt;
|
||||
iAmt = extra;
|
||||
}else{
|
||||
rc = SQLITE_IOERR_WRITE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -845,6 +856,9 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){
|
||||
pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL);
|
||||
if( pSubOpen ){
|
||||
rc = pSubOpen->pMethods->xFileControl(pSubOpen, op, pArg);
|
||||
if( op==SQLITE_FCNTL_VFSNAME && rc==SQLITE_OK ){
|
||||
*(char**)pArg = sqlite3_mprintf("multiplex/%z", *(char**)pArg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -857,7 +871,7 @@ static int multiplexSectorSize(sqlite3_file *pConn){
|
||||
multiplexConn *p = (multiplexConn*)pConn;
|
||||
int rc;
|
||||
sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL);
|
||||
if( pSubOpen ){
|
||||
if( pSubOpen && pSubOpen->pMethods->xSectorSize ){
|
||||
return pSubOpen->pMethods->xSectorSize(pSubOpen);
|
||||
}
|
||||
return DEFAULT_SECTOR_SIZE;
|
||||
|
@ -389,7 +389,11 @@ static int vfslogCheckReservedLock(sqlite3_file *pFile, int *pResOut){
|
||||
*/
|
||||
static int vfslogFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
VfslogFile *p = (VfslogFile *)pFile;
|
||||
return p->pReal->pMethods->xFileControl(p->pReal, op, pArg);
|
||||
int rc = p->pReal->pMethods->xFileControl(p->pReal, op, pArg);
|
||||
if( op==SQLITE_FCNTL_VFSNAME && rc==SQLITE_OK ){
|
||||
*(char**)pArg = sqlite3_mprintf("vfslog/%z", *(char**)pArg);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -589,7 +589,11 @@ static int quotaCheckReservedLock(sqlite3_file *pConn, int *pResOut){
|
||||
*/
|
||||
static int quotaFileControl(sqlite3_file *pConn, int op, void *pArg){
|
||||
sqlite3_file *pSubOpen = quotaSubOpen(pConn);
|
||||
return pSubOpen->pMethods->xFileControl(pSubOpen, op, pArg);
|
||||
int rc = pSubOpen->pMethods->xFileControl(pSubOpen, op, pArg);
|
||||
if( op==SQLITE_FCNTL_VFSNAME && rc==SQLITE_OK ){
|
||||
*(char**)pArg = sqlite3_mprintf("quota/%z", *(char**)pArg);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Pass xSectorSize requests through to the original VFS unchanged.
|
||||
|
@ -471,6 +471,10 @@ static int vfstraceFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
}
|
||||
case SQLITE_FCNTL_FILE_POINTER: zOp = "FILE_POINTER"; break;
|
||||
case SQLITE_FCNTL_SYNC_OMITTED: zOp = "SYNC_OMITTED"; break;
|
||||
case SQLITE_FCNTL_WIN32_AV_RETRY: zOp = "WIN32_AV_RETRY"; break;
|
||||
case SQLITE_FCNTL_PERSIST_WAL: zOp = "PERSIST_WAL"; break;
|
||||
case SQLITE_FCNTL_OVERWRITE: zOp = "OVERWRITE"; break;
|
||||
case SQLITE_FCNTL_VFSNAME: zOp = "VFSNAME"; break;
|
||||
case 0xca093fa0: zOp = "DB_UNCHANGED"; break;
|
||||
default: {
|
||||
sqlite3_snprintf(sizeof zBuf, zBuf, "%d", op);
|
||||
@ -482,6 +486,10 @@ static int vfstraceFileControl(sqlite3_file *pFile, int op, void *pArg){
|
||||
pInfo->zVfsName, p->zFName, zOp);
|
||||
rc = p->pReal->pMethods->xFileControl(p->pReal, op, pArg);
|
||||
vfstrace_print_errcode(pInfo, " -> %s\n", rc);
|
||||
if( op==SQLITE_FCNTL_VFSNAME && rc==SQLITE_OK ){
|
||||
*(char**)pArg = sqlite3_mprintf("vfstrace.%s/%z",
|
||||
pInfo->zVfsName, *(char**)pArg);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,7 @@ proc multiplex_restore_db {} {
|
||||
foreach f [glob -nocomplain test.*] {forcedelete $f}
|
||||
foreach f [glob -nocomplain sv_test.*] {forcecopy $f [string range $f 3 end]} }
|
||||
|
||||
|
||||
do_test 1.0 {
|
||||
proc setup_and_save_db {} {
|
||||
multiplex_delete_db
|
||||
sqlite3 db file:test.db?8_3_names=1
|
||||
sqlite3_multiplex_control db main chunk_size [expr 256*1024]
|
||||
@ -76,14 +75,17 @@ do_test 1.0 {
|
||||
set ::cksum1 [execsql {SELECT md5sum(a, b) FROM t1 ORDER BY a}]
|
||||
db close
|
||||
multiplex_save_db
|
||||
} {}
|
||||
}
|
||||
|
||||
do_test 1.0 { setup_and_save_db } {}
|
||||
do_faultsim_test 1 -prep {
|
||||
multiplex_restore_db
|
||||
sqlite3 db file:test.db?8_3_names=1
|
||||
sqlite3_multiplex_control db main chunk_size [expr 256*1024]
|
||||
} -body {
|
||||
execsql "UPDATE t1 SET a=randomblob(12), b=randomblob(1500) WHERE (rowid%32)=0"
|
||||
execsql {
|
||||
UPDATE t1 SET a=randomblob(12), b=randomblob(1500) WHERE (rowid%32)=0
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
if {$testrc!=0} {
|
||||
@ -92,7 +94,40 @@ do_faultsim_test 1 -prep {
|
||||
}
|
||||
}
|
||||
|
||||
catch { db close }
|
||||
#-------------------------------------------------------------------------
|
||||
# The following tests verify that hot-journal rollback works. As follows:
|
||||
#
|
||||
# 1. Create a large database.
|
||||
# 2. Set the pager cache to be very small.
|
||||
# 3. Open a transaction.
|
||||
# 4. Run the following 100 times:
|
||||
# a. Update a row.
|
||||
# b. Copy all files on disk to a new db location, including the journal.
|
||||
# c. Verify that the new db can be opened and that the content matches
|
||||
# the database created in step 1 (proving the journal was rolled
|
||||
# back).
|
||||
|
||||
do_test 2.0 {
|
||||
setup_and_save_db
|
||||
multiplex_restore_db
|
||||
sqlite3 db file:test.db?8_3_names=1
|
||||
execsql { PRAGMA cache_size = 10 }
|
||||
execsql { BEGIN }
|
||||
} {}
|
||||
|
||||
for {set iTest 1} {$iTest<=100} {incr iTest} {
|
||||
do_test 2.$iTest {
|
||||
execsql {
|
||||
UPDATE t1 SET a=randomblob(12), b=randomblob(1400) WHERE rowid=5*$iTest
|
||||
}
|
||||
foreach f [glob -nocomplain test.*] {forcecopy $f "xx_$f"}
|
||||
sqlite3 db2 file:xx_test.db?8_3_names=1
|
||||
execsql {SELECT md5sum(a, b) FROM t1 ORDER BY a} db2
|
||||
} $::cksum1
|
||||
|
||||
db2 close
|
||||
}
|
||||
|
||||
catch { db close }
|
||||
sqlite3_multiplex_shutdown
|
||||
finish_test
|
||||
|
@ -14,6 +14,8 @@ set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
|
||||
unset -nocomplain defaultVfs
|
||||
set defaultVfs [file_control_vfsname db]
|
||||
db close
|
||||
|
||||
do_test quota-1.1 { sqlite3_quota_initialize nosuchvfs 1 } {SQLITE_ERROR}
|
||||
@ -73,6 +75,9 @@ do_test quota-2.1.2 {
|
||||
}
|
||||
set ::quota
|
||||
} {}
|
||||
do_test quota-2.1.2.1 {
|
||||
file_control_vfsname db
|
||||
} quota/$defaultVfs
|
||||
do_test quota-2.1.3 { file size test.db } {4096}
|
||||
do_test quota-2.1.4 {
|
||||
catchsql { INSERT INTO t1 VALUES(3, randomblob(1100)) }
|
||||
|
Loading…
Reference in New Issue
Block a user