If the database filename is an empty string, open a temporary file to hold

the database.  Ticket #432. (CVS 1085)

FossilOrigin-Name: da53369f0bf133b89b213bbb1ccea13eb93ab6ed
This commit is contained in:
drh 2003-08-26 11:25:58 +00:00
parent 263659be4d
commit 901afd4341
4 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Close\sfiles\sbefore\sdeleting\sthem\son\stest\sscripts\sunder\sWin2k.\nTicket\s#434.\s(CVS\s1084)
D 2003-08-26T11:18:19
C If\sthe\sdatabase\sfilename\sis\san\sempty\sstring,\sopen\sa\stemporary\sfile\sto\shold\nthe\sdatabase.\s\sTicket\s#432.\s(CVS\s1085)
D 2003-08-26T11:25:58
F Makefile.in f7e916ae863393827fa6a4cb292e3398096edcf1
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -37,7 +37,7 @@ F src/main.c 2500392bad5629b6d70b06ac5a076958acb49b92
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c 97df440bc71f65e22df5d3d920ce39551c0a5f5a
F src/os.h 729395fefcca4b81ae056aa9ff67b72bb40dd9e0
F src/pager.c a4fd3a61d63879365f775875edfffaa8c6f3d7f8
F src/pager.c 48abfc7dae5259b7ca040a335bf3cd6e05ca761e
F src/pager.h 5da62c83443f26b1792cfd72c96c422f91aadd31
F src/parse.y 16aed0e3ed05445fa7f6a4209cc054208c7083c0
F src/pragma.c cee60f17679210e8acd30d5bdee855716d0c898c
@ -97,7 +97,7 @@ F test/memdb.test 6ece25c7c0e6500199d3662607a3edca081abb2a
F test/memleak.test a18e6810cae96d2f6f5136920267adbefc8e1e90
F test/minmax.test 6d9b6d6ee34f42e2a58dffece1f76d35f446b3af
F test/misc1.test 0b98d493b0cf55cb5f53e1f3df8107c166eecb5a
F test/misc2.test 6400032fe041360f717f501930585498853d79ae
F test/misc2.test 48f1f2187831a89dc4785f493c0c320b3be61a32
F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
@ -168,7 +168,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
P 1aa3658ef54fad7f2b7f61d91641472551468cdc
R e70ec890d37fc97e4fac3e160d7ae3bc
P 2a40b46140720783cf4002fb9993f7f6766dbf5f
R 4050da4610851d1f5ae1706b56d51956
U drh
Z 17d590e2ec78d9d5f695b403c303ad26
Z cb698fdf25490f5d03df521b9648eaf1

View File

@ -1 +1 @@
2a40b46140720783cf4002fb9993f7f6766dbf5f
da53369f0bf133b89b213bbb1ccea13eb93ab6ed

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.87 2003/07/27 18:59:43 drh Exp $
** @(#) $Id: pager.c,v 1.88 2003/08/26 11:25:58 drh Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
@ -838,7 +838,7 @@ int sqlitepager_open(
if( sqlite_malloc_failed ){
return SQLITE_NOMEM;
}
if( zFilename ){
if( zFilename && zFilename[0] ){
zFullPathname = sqliteOsFullPathname(zFilename);
rc = sqliteOsOpenReadWrite(zFullPathname, &fd, &readOnly);
tempFile = 0;

View File

@ -13,7 +13,7 @@
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc2.test,v 1.6 2003/07/30 12:34:13 drh Exp $
# $Id: misc2.test,v 1.7 2003/08/26 11:25:58 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -114,3 +114,17 @@ do_test misc2-5.1 {
SELECT * from z;
}
} {}
# Make sure we can open a database with an empty filename. What this
# does is store the database in a temporary file that is deleted when
# the database is closed. Ticket #432.
#
do_test misc2-6.1 {
db close
sqlite db {}
execsql {
CREATE TABLE t1(a,b);
INSERT INTO t1 VALUES(1,2);
SELECT * FROM t1;
}
} {1 2}