1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-27 08:52:26 +03:00

Add PRAGMA 'temp_store_directory'. Added os_*.c function

sqlite3OsIsDirWritable(), split pragma.c changeTempStorage() function into
invalidateTempStorage(). (CVS 2171)

FossilOrigin-Name: 772e22cbd69463be41c2e73b4fd4eb33946193c4
This commit is contained in:
tpoindex
2004-12-20 19:01:32 +00:00
parent 9012bcbc0a
commit 9a09a3caed
11 changed files with 270 additions and 34 deletions

View File

@@ -574,7 +574,7 @@ int sqlite3OsOpenDirectory(
** name of a directory, then that directory will be used to store
** temporary files.
*/
const char *sqlite3_temp_directory = 0;
char *sqlite3_temp_directory = 0;
/*
** Create a temporary file name in zBuf. zBuf must be big enough to
@@ -616,6 +616,20 @@ int sqlite3OsTempFileName(char *zBuf){
return SQLITE_OK;
}
/*
** Check that a given pathname is a directory and is writable
**
*/
int sqlite3OsIsDirWritable(char *zBuf){
struct stat buf;
if( zBuf==0 ) return 0;
if( strlen(zBuf)==0 ) return 0;
if( stat(zBuf, &buf) ) return 0;
if( !S_ISDIR(buf.st_mode) ) return 0;
if( access(zBuf, 07) ) return 0;
return 1;
}
/*
** Read data from a file into a buffer. Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes