Fix bugs in temp database handling introduced by the prevous check-in. (CVS 4288)
FossilOrigin-Name: 300038be9368556a29efce7cf3657fabfe54d8f9
This commit is contained in:
parent
1cc8c448b5
commit
ae28c01aa8
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Remove\snRef\sand\svfsMutex\sfrom\sthe\ssqlite3_vfs\sstructure.\s\sOmit\sthe\nsqlite3_vfs_release()\sinterface.\s\sLess\smemory\sallocated\sfor\sa\spager\nin\sthe\scommon\scase\swhere\sthe\ssize\sof\sthe\spathname\sis\sless\sthan\sMAX_PATH.\s(CVS\s4287)
|
||||
D 2007-08-24T16:08:29
|
||||
C Fix\sbugs\sin\stemp\sdatabase\shandling\sintroduced\sby\sthe\sprevous\scheck-in.\s(CVS\s4288)
|
||||
D 2007-08-24T16:29:24
|
||||
F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe
|
||||
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -115,7 +115,7 @@ F src/os_unix.c 27b1fad58587bc949013a5a4df9fc20fce395648
|
||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||
F src/os_win.c e2598a18dbcb70cba888cebd37fb46d1eaee82b1
|
||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||
F src/pager.c f5c2a4e85b632faa7cd891c214f1cfd021c1ffa9
|
||||
F src/pager.c b076458d72dcda7517c49aae0f0fd43c9a1195e5
|
||||
F src/pager.h 53087c6fb9db01aed17c7fd044662a27507e89b8
|
||||
F src/parse.y 2d2ce439dc6184621fb0b86f4fc5aca7f391a590
|
||||
F src/pragma.c 9b989506a1b7c8aecd6befb8235e2f57a4aba7e5
|
||||
@ -368,7 +368,7 @@ F test/misc7.test a67af9620a510ce19f96ba69f3848228b7c62a73
|
||||
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
|
||||
F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82
|
||||
F test/null.test 9503e1f63e959544c006d9f01709c5b5eab67d54
|
||||
F test/pager.test f07c06fef8e3b4964a9b337b751b56825a44d326
|
||||
F test/pager.test 60303481b22b240c18d6dd1b64edcecc2f4b5a97
|
||||
F test/pager2.test c025f91b75fe65e85febda64d9416428b8a5cab5
|
||||
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
|
||||
F test/pageropt.test 51e3c091bc2992f5098f7576e3594e1908988939
|
||||
@ -561,7 +561,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 13dda2e8e879835c21e539ba3ff8f96face1af4c
|
||||
R 9943ec857d44edaed5e279e84f17aaa5
|
||||
P b8451da378179d43f25d9a014480c0f13dd1dc37
|
||||
R 56a3777f2f9b394db341a6008cd56bd7
|
||||
U drh
|
||||
Z a0440ce84e84a78d112a7ad4d7f13668
|
||||
Z 62539d3b8746b570b0ccb1349666e464
|
||||
|
@ -1 +1 @@
|
||||
b8451da378179d43f25d9a014480c0f13dd1dc37
|
||||
300038be9368556a29efce7cf3657fabfe54d8f9
|
42
src/pager.c
42
src/pager.c
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.375 2007/08/24 16:08:29 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.376 2007/08/24 16:29:24 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -1808,15 +1808,17 @@ int sqlite3_opentemp_count = 0;
|
||||
** other error code if we fail. The OS will automatically delete the temporary
|
||||
** file when it is closed.
|
||||
**
|
||||
** If zNameOut is 0, then SQLITE_OPEN_SUBJOURNAL is passed to the OS layer.
|
||||
** If zNameOut is not 0, SQLITE_OPEN_TEMP_DB is passed.
|
||||
** If zFilename is 0, then an appropriate temporary filename is
|
||||
** generated automatically and SQLITE_OPEN_SUBJOURNAL is passed to
|
||||
** the OS layer as the file type.
|
||||
**
|
||||
** If zFilename is not 0, SQLITE_OPEN_TEMP_DB is passed as the file type.
|
||||
*/
|
||||
static int sqlite3PagerOpentemp(
|
||||
sqlite3_vfs *pVfs,
|
||||
sqlite3_file *pFile,
|
||||
char *zNameOut
|
||||
char *zFilename
|
||||
){
|
||||
int cnt = 8;
|
||||
int rc;
|
||||
int flags = (
|
||||
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|
|
||||
@ -1824,13 +1826,18 @@ static int sqlite3PagerOpentemp(
|
||||
);
|
||||
|
||||
char *zFree = 0;
|
||||
if( zNameOut==0 ){
|
||||
if( zFilename==0 ){
|
||||
zFree = (char *)sqlite3_malloc(pVfs->mxPathname);
|
||||
if( !zFree ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
zNameOut = zFree;
|
||||
zFilename = zFree;
|
||||
flags |= SQLITE_OPEN_SUBJOURNAL;
|
||||
rc = sqlite3OsGetTempName(pVfs, zFilename);
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3_free(zFree);
|
||||
return rc;
|
||||
}
|
||||
}else{
|
||||
flags |= SQLITE_OPEN_TEMP_DB;
|
||||
}
|
||||
@ -1839,13 +1846,8 @@ static int sqlite3PagerOpentemp(
|
||||
sqlite3_opentemp_count++; /* Used for testing and analysis only */
|
||||
#endif
|
||||
|
||||
do{
|
||||
cnt--;
|
||||
sqlite3OsGetTempName(pVfs, zNameOut);
|
||||
rc = sqlite3OsOpen(pVfs, zNameOut, pFile, flags, 0);
|
||||
assert( rc!=SQLITE_OK || pFile->pMethods );
|
||||
}while( cnt>0 && rc!=SQLITE_OK && rc!=SQLITE_NOMEM );
|
||||
|
||||
rc = sqlite3OsOpen(pVfs, zFilename, pFile, flags, 0);
|
||||
assert( rc!=SQLITE_OK || pFile->pMethods );
|
||||
sqlite3_free(zFree);
|
||||
return rc;
|
||||
}
|
||||
@ -1902,13 +1904,13 @@ int sqlite3PagerOpen(
|
||||
#endif
|
||||
{
|
||||
rc = sqlite3OsFullPathname(pVfs, zFilename, zPathname);
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3_free(zPathname);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
zPathname[0] = 0;
|
||||
rc = sqlite3OsGetTempName(pVfs, zPathname);
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3_free(zPathname);
|
||||
return rc;
|
||||
}
|
||||
nPathname = strlen(zPathname);
|
||||
|
||||
@ -1936,7 +1938,7 @@ int sqlite3PagerOpen(
|
||||
|
||||
/* Open the pager file.
|
||||
*/
|
||||
if( pPager->zFilename[0] ){
|
||||
if( zFilename && zFilename[0] && !memDb ){
|
||||
if( nPathname>(pVfs->mxPathname - sizeof("-journal")) ){
|
||||
rc = SQLITE_CANTOPEN;
|
||||
}else{
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is page cache subsystem.
|
||||
#
|
||||
# $Id: pager.test,v 1.29 2007/08/24 16:08:29 drh Exp $
|
||||
# $Id: pager.test,v 1.30 2007/08/24 16:29:24 drh Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -409,7 +409,6 @@ do_test pager-4.6.1 {
|
||||
# Test truncate on an in-memory database is Ok.
|
||||
ifcapable memorydb {
|
||||
do_test pager-4.6.2 {
|
||||
btree_breakpoint
|
||||
set ::p2 [pager_open :memory: 10]
|
||||
pager_truncate $::p2 5
|
||||
} {}
|
||||
|
Loading…
Reference in New Issue
Block a user