-C Fix\sa\sstack\soverflow\sproblem\swith\sINSTEAD\sOF\striggers.\s(CVS\s1310)
-D 2004-04-29T16:16:29
+C Add\sthe\ssqlite_temp_directory\sglobal\svariable\swhich,\sif\sset,\sdefines\sthe\ndirectory\sin\swhich\stemporary\sfiles\sare\screated.\s(CVS\s1316)
+D 2004-05-07T00:57:06
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/insert.c c0485ee2d1b99322894e2d1e0b576fd05ed75616
F src/main.c 94dd355768e2a389e184a069b6880f4bac100307
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
-F src/os.c 5f11382733805d4529ec2a30800e117f30995ea8
+F src/os.c edcd42ad1cf13e7322f814c50a3e6eb09d3915bb
F src/os.h 250a3789be609adfee5c5aa20137ce8683276f24
F src/pager.c b246986e5ba31b15aa3cf91d3b9ec2e608aceb8e
F src/pager.h 82332878799280145639a48d88cdb4058925e3f6
F src/sqliteInt.h 235ce244b62bb26cc9ab394fb7a0724dd4e65c83
F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
F src/tclsqlite.c 819d92d305756c4ea57de023c387d2fa8a256aff
-F src/test1.c 9aa62b89d420e6763b5e7ae89a47f6cf87370477
+F src/test1.c 4ae20bc125b1a7d7824cccca55d538d81f0b4949
F src/test2.c 75819b0f2c63c6a0fd6995445881f2eb94036996
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
F src/test4.c 6e3e31acfaf21d66420fc35fda5b17dc0000cc8d
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P b8b8ce5c81ef614d488e0f79df8935ef609dc4f2
-R 09116ec27eaf3c7f0c80f307e42d61db
+P 5a33e0b06f495628704d0881940a792f342facc7
+R 43b881fc6eae3c147e100628eed1f28a
U drh
-Z f5047c70c45fb9bcbbd3fb6ce59d57f5
+Z fa1184d1e363db84111f9914f4de11d2
return SQLITE_OK;
}
+/*
+** If the following global variable points to a string which is the
+** name of a directory, then that directory will be used to store
+** temporary files.
+*/
+const char *sqlite_temp_directory = 0;
+
/*
** Create a temporary file name in zBuf. zBuf must be big enough to
** hold at least SQLITE_TEMPNAME_SIZE characters.
int sqliteOsTempFileName(char *zBuf){
#if OS_UNIX
static const char *azDirs[] = {
+ 0,
"/var/tmp",
"/usr/tmp",
"/tmp",
int i, j;
struct stat buf;
const char *zDir = ".";
+ azDirs[0] = sqlite_temp_directory;
for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
+ if( azDirs[i]==0 ) continue;
if( stat(azDirs[i], &buf) ) continue;
if( !S_ISDIR(buf.st_mode) ) continue;
if( access(azDirs[i], 07) ) continue;
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
int i, j;
+ char *zDir;
char zTempPath[SQLITE_TEMPNAME_SIZE];
- GetTempPath(SQLITE_TEMPNAME_SIZE-30, zTempPath);
- for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
- zTempPath[i] = 0;
+ if( sqlite_temp_directory==0 ){
+ GetTempPath(SQLITE_TEMPNAME_SIZE-30, zTempPath);
+ for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
+ zTempPath[i] = 0;
+ zDir = zTempPath;
+ }else{
+ zDir = sqlite_temp_directory;
+ }
for(;;){
- sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zTempPath);
+ sprintf(zBuf, "%s\\"TEMP_FILE_PREFIX, zDir);
j = strlen(zBuf);
sqliteRandomness(15, &zBuf[j]);
for(i=0; i<15; i++, j++){
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
int i, j;
+ char *zDir;
char zTempPath[SQLITE_TEMPNAME_SIZE];
char zdirName[32];
CInfoPBRec infoRec;
Str31 dirName;
memset(&infoRec, 0, sizeof(infoRec));
memset(zTempPath, 0, SQLITE_TEMPNAME_SIZE);
- if( FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder,
+ if( sqlite_temp_directory!=0 ){
+ zDir = sqlite_temp_directory;
+ }else if( FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder,
&(infoRec.dirInfo.ioVRefNum), &(infoRec.dirInfo.ioDrParID)) == noErr ){
infoRec.dirInfo.ioNamePtr = dirName;
do{
break;
}
} while( infoRec.dirInfo.ioDrDirID != fsRtDirID );
+ zDir = zTempPath;
}
- if( *zTempPath == 0 )
+ if( zDir[0]==0 ){
getcwd(zTempPath, SQLITE_TEMPNAME_SIZE-24);
+ zDir = zTempPath;
+ }
for(;;){
- sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zTempPath);
+ sprintf(zBuf, "%s"TEMP_FILE_PREFIX, zDir);
j = strlen(zBuf);
sqliteRandomness(15, &zBuf[j]);
for(i=0; i<15; i++, j++){
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.36 2004/02/22 17:49:34 drh Exp $
+** $Id: test1.c,v 1.36.2.1 2004/05/07 00:57:06 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
extern int sqlite_interrupt_count;
extern int sqlite_open_file_count;
extern int sqlite_current_time;
+ extern int sqlite_temp_directory;
static struct {
char *zName;
Tcl_CmdProc *xProc;
(char*)&sqlite_current_time, TCL_LINK_INT);
Tcl_LinkVar(interp, "sqlite_static_bind_value",
(char*)&sqlite_static_bind_value, TCL_LINK_STRING);
+ Tcl_LinkVar(interp, "sqlite_temp_directory",
+ (char*)&sqlite_temp_directory, TCL_LINK_STRING);
return TCL_OK;
}