0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-12-01 17:23:42 +01:00

Fix for registration of non-default vfs objects. (CVS 4360)

FossilOrigin-Name: 5f48fb95c26a713b3259ee49fd444108030376dc
This commit is contained in:
danielk1977 2007-09-01 06:51:27 +00:00
parent c3f759bd33
commit 95c8a54c7d
9 changed files with 39 additions and 25 deletions

View File

@ -301,7 +301,6 @@ objects: $(LIBOBJ_ORIG)
# all that automatic generation.
#
target_source: $(SRC)
@echo $(SRC)
rm -rf tsrc
mkdir tsrc
cp -f $(SRC) tsrc

View File

@ -1,5 +1,5 @@
C Fix\sa\sbug\sin\sloadext.test.\s(CVS\s4359)
D 2007-09-01T06:19:06
C Fix\sfor\sregistration\sof\snon-default\svfs\sobjects.\s(CVS\s4360)
D 2007-09-01T06:51:28
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -63,7 +63,7 @@ F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33
F ext/icu/icu.c 61a345d8126686aa3487aa8d2d0f68abd655f7a4
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387
F main.mk 423379cb666309af9bf7a4c9360582d2af300bc0
F main.mk ce638342ef19844812eaade3b8a944709bb2813e
F mkdll.sh 37fa8a7412e51b5ab2bc6d4276135f022a0feffb
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 1a866b53637dab137191341cc875575a5ca110fb
@ -99,7 +99,7 @@ F src/journal.c 2e0fb96d5e407a28b756b4a8b3694f2dccabe7f8
F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
F src/loadext.c 6894dbbf1666577d957922811620375d6c2f058d
F src/main.c 00a894cd348d8d3651097bb8136f03e53afa644b
F src/main.c c271d9104b6bff13d2ddd9a72fcf0926e635a9fd
F src/malloc.c de4e77fe70a9a0ac47a1c3a874422b107231bf31
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/mem1.c afe2fbf6d7e8247c6c9f69c1481358b1cad60c08
@ -109,14 +109,14 @@ F src/mutex.h 079fa6fe9da18ceb89e79012c010594c6672addb
F src/mutex_os2.c d47e9bd495583dd31263d8fe55160a31eb600a3c
F src/mutex_unix.c ff77650261a245035b79c5c8a174f4e05d3cae8a
F src/mutex_w32.c 54beb16ade8f80ea2bc30bc4dfb2087be3487ef3
F src/os.c cc8b74355c931b360a23a8e88e07091e4baa39b8
F src/os.c 27dea97099f9dd8d4b3fdf6177539146c6f3aeac
F src/os.h 53e65427899ed5697d79749d646e6a297b70171a
F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f
F src/os_os2.c 8769301bff502de642ad2634cedcb77d967ce199
F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c 4d36cd037540a9c2af540bd15ab9d2a1dcc164fe
F src/os_unix.c 9043705193a53f9ba8aca9284b5788ce6cda0010
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c ce778c06afcbfd120ede237befece4655e83c8d0
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
@ -141,7 +141,7 @@ F src/test2.c 4ab230fbdc0decfa7422f6a052b609ba54f4dfac
F src/test3.c 199a440ba2b38b26251393b609451a3484a15907
F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
F src/test6.c 128084277e05073df360a030af68c22c62e19b2b
F src/test6.c e6ce0d295f524416cb08d30c62c1fb3135962169
F src/test7.c a9d509d0e9ad214b4772696f49f6e61be26213d1
F src/test8.c 88e033aefdf5d5522dff46655a14ea7360fb1d26
F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
@ -418,9 +418,9 @@ F test/substr.test 9f26cfca74397b26ab217fb838c3d0549eb4bcf3
F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3
F test/table.test dbdfd06aef054ad5aed8e57a782137d57d5c5528
F test/tableapi.test 036575a98dcce7c92e9f39056839bbad8a715412
F test/tclsqlite.test 3addd6a88b8a756ec802ca8840587fa3d61bfcff
F test/tclsqlite.test a868898e3350246be7ea132621dc25f9835b3030
F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
F test/tester.tcl 577c2eb71a6e308f8e4d6b283c6a0d2966ed2824
F test/tester.tcl a18c4ef2233eb87e7717b4578aef3cf6b119993c
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 3d74256c9123e8434c68e6a0c5b61686b34a4328
R 1c0347842404603d8a4dc887d9128ff6
P 2be8af9d402a5cd8da8c348883188eb38900f6dc
R 1475678fd3272d043d92d10be839de03
U danielk1977
Z 352000b212599994e03c0b4ef61b1896
Z 4664902be98fc827f7437460eb18f666

View File

@ -1 +1 @@
2be8af9d402a5cd8da8c348883188eb38900f6dc
5f48fb95c26a713b3259ee49fd444108030376dc

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.401 2007/08/31 16:11:36 drh Exp $
** $Id: main.c,v 1.402 2007/09/01 06:51:28 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -950,7 +950,6 @@ static int openDatabase(
goto opendb_out;
}
sqlite3_mutex_enter(db->mutex);
db->pVfs = sqlite3_vfs_find(zVfs);
db->errMask = 0xff;
db->priorNewRowid = 0;
db->nDb = 2;
@ -971,6 +970,14 @@ static int openDatabase(
sqlite3HashInit(&db->aModule, SQLITE_HASH_STRING, 0);
#endif
db->pVfs = sqlite3_vfs_find(zVfs);
if( !db->pVfs ){
rc = SQLITE_ERROR;
db->magic = SQLITE_MAGIC_CLOSED;
sqlite3Error(db, rc, "no such vfs: %s", (zVfs?zVfs:"(null)"));
goto opendb_out;
}
/* Add the default collation sequence BINARY. BINARY works for both UTF-8
** and UTF-16, so add a version for each to avoid any unnecessary
** conversions. The only error that can occur here is a malloc() failure.

View File

@ -224,7 +224,7 @@ int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
vfsList = pVfs;
}else{
pVfs->pNext = vfsList->pNext;
pVfs->pNext = pVfs;
vfsList->pNext = pVfs;
}
assert(vfsList);
sqlite3_mutex_leave(mutex);

View File

@ -2568,14 +2568,20 @@ static int unixFullPathname(sqlite3_vfs *pVfs, const char *zPath, char *zOut){
static void *unixDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);
}
/*
** SQLite calls this function immediately after a call to unixDlSym() or
** unixDlOpen() fails (returns a null pointer). If a more detailed error
** message is available, it is written to zBufOut. If no error message
** is available, zBufOut is left unmodified and SQLite uses a default
** error message.
*/
static void unixDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
char *zErr;
enterMutex();
zErr = dlerror();
if( zErr ){
sqlite3_snprintf(nBuf, zBufOut, "%s", zErr);
}else if(nBuf>0) {
zBufOut[0] = '\0';
}
leaveMutex();
}

View File

@ -753,8 +753,7 @@ static int crashParamsObjCmd(
crashVfs.mxPathname = pOriginalVfs->mxPathname;
crashVfs.pAppData = (void *)pOriginalVfs;
crashVfs.szOsFile = sizeof(CrashFile) + pOriginalVfs->szOsFile;
/* sqlite3_vfs_unregister(pOriginalVfs); */
sqlite3_vfs_register(&crashVfs, 1);
sqlite3_vfs_register(&crashVfs, 0);
}
iDc = -1;

View File

@ -15,7 +15,7 @@
# interface is pretty well tested. This file contains some addition
# tests for fringe issues that the main test suite does not cover.
#
# $Id: tclsqlite.test,v 1.60 2007/08/31 14:31:45 drh Exp $
# $Id: tclsqlite.test,v 1.61 2007/09/01 06:51:28 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -138,7 +138,10 @@ do_test tcl-1.20 {
set v [catch {db copy} msg]
lappend v $msg
} {1 {wrong # args: should be "db copy CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?"}}
do_test tcl-1.21 {
set v [catch {sqlite3 db2 test.db -vfs nosuchvfs} msg]
lappend v $msg
} {1 {no such vfs: nosuchvfs}}
catch {unset ::result}
do_test tcl-2.1 {

View File

@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.89 2007/08/31 14:31:45 drh Exp $
# $Id: tester.tcl,v 1.90 2007/09/01 06:51:28 danielk1977 Exp $
set tcl_precision 15
@ -358,7 +358,7 @@ proc crashsql {args} {
set f [open crash.tcl w]
puts $f "sqlite3_crashparams $blocksize $dc $crashdelay $cfile"
puts $f "set sqlite_pending_byte $::sqlite_pending_byte"
puts $f "sqlite3 db test.db"
puts $f "sqlite3 db test.db -vfs crash"
# This block sets the cache size of the main database to 10
# pages. This is done in case the build is configured to omit