Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fixes to the temp_store_directory pragma. (CVS 2185) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0a90eaf398aa4a689cd8326cd0179515 |
User & Date: | drh 2005-01-08 15:44:26.000 |
Context
2005-01-08
| ||
18:42 | Tcl interface does as sqlite3 or as sqlite. A compile-time option allows duel linking. Also fix a bug in the pragma change from earlier today. (CVS 2186) (check-in: ad10953799 user: drh tags: trunk) | |
15:44 | Fixes to the temp_store_directory pragma. (CVS 2185) (check-in: 0a90eaf398 user: drh tags: trunk) | |
15:43 | Fix a comment. (CVS 2184) (check-in: 26fbac8f03 user: drh tags: trunk) | |
Changes
Changes to src/os_unix.c.
︙ | ︙ | |||
612 613 614 615 616 617 618 619 620 621 622 623 624 625 | zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; } zBuf[j] = 0; }while( access(zBuf,0)==0 ); 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; | > | > | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; } zBuf[j] = 0; }while( access(zBuf,0)==0 ); return SQLITE_OK; } #ifndef SQLITE_OMIT_PAGER_PRAGMAS /* ** Check that a given pathname is a directory and is writable ** */ int sqlite3OsIsDirWritable(char *zBuf){ struct stat buf; if( zBuf==0 ) return 0; if( zBuf[0]==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; } #endif /* SQLITE_OMIT_PAGER_PRAGMAS */ /* ** Read data from a file into a buffer. Return SQLITE_OK if all ** bytes were read successfully and SQLITE_IOERR if anything goes ** wrong. */ int sqlite3OsRead(OsFile *id, void *pBuf, int amt){ |
︙ | ︙ |
Changes to src/os_win.c.
︙ | ︙ | |||
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | res = UnlockFile(id->h, SHARED_FIRST, 0, SHARED_SIZE, 0); }else{ res = UnlockFile(id->h, SHARED_FIRST + id->sharedLockByte, 0, 1, 0); } return res; } /* ** Check that a given pathname is a directory and is writable ** */ int sqlite3OsIsDirWritable(char *zBuf){ int fileAttr; if(! zBuf ) return 0; if(! isNT() && strlen(zBuf) > MAX_PATH ) return 0; fileAttr = GetFileAttributesA(zBuf); if( fileAttr == 0xffffffff ) return 0; | > | | | > | > | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | res = UnlockFile(id->h, SHARED_FIRST, 0, SHARED_SIZE, 0); }else{ res = UnlockFile(id->h, SHARED_FIRST + id->sharedLockByte, 0, 1, 0); } return res; } #ifndef SQLITE_OMIT_PAGER_PRAGMAS /* ** Check that a given pathname is a directory and is writable ** */ int sqlite3OsIsDirWritable(char *zBuf){ int fileAttr; if(! zBuf ) return 0; if(! isNT() && strlen(zBuf) > MAX_PATH ) return 0; fileAttr = GetFileAttributesA(zBuf); if( fileAttr == 0xffffffff ) return 0; if( (fileAttr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ){ return 0; } return 1; } #endif /* SQLITE_OMIT_PAGER_PRAGMAS */ /* ** Lock the file with the lock specified by parameter locktype - one ** of the following: ** ** (1) SHARED_LOCK ** (2) RESERVED_LOCK |
︙ | ︙ |
Changes to src/pragma.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** ** $Id: pragma.c,v 1.82 2005/01/08 15:44:26 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* Ignore this whole file if pragmas are disabled */ #ifndef SQLITE_OMIT_PRAGMA #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) |
︙ | ︙ | |||
369 370 371 372 373 374 375 | if( sqlite3_temp_directory ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "temp_store_directory", P3_STATIC); sqlite3VdbeOp3(v, OP_String8, 0, 0, sqlite3_temp_directory, 0); sqlite3VdbeAddOp(v, OP_Callback, 1, 0); } }else{ | | | > > | | < | < > | | < | < < | < < < < < < | < > | < < < < | < < < < < < < < < < < | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | if( sqlite3_temp_directory ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "temp_store_directory", P3_STATIC); sqlite3VdbeOp3(v, OP_String8, 0, 0, sqlite3_temp_directory, 0); sqlite3VdbeAddOp(v, OP_Callback, 1, 0); } }else{ if( zRight[0] && !sqlite3OsIsDirWritable(zRight) ){ sqlite3ErrorMsg(pParse, "not a writable directory"); goto pragma_out; } if( TEMP_STORE==0 || (TEMP_STORE==1 && db->temp_store<=1) || (TEMP_STORE==2 && db->temp_store==1) ){ invalidateTempStorage(pParse); } sqliteFree(sqlite3_temp_directory); if( zRight[0] ){ sqlite3_temp_directory = zRight; zRight = 0; }else{ sqlite3_temp_directory = 0; } } }else /* ** PRAGMA [database.]synchronous ** PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL |
︙ | ︙ |
Changes to test/pragma.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the PRAGMA command. # # $Id: pragma.test,v 1.30 2005/01/08 15:44:26 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # pragma-1.*: Test cache_size, default_cache_size and synchronous on main db. |
︙ | ︙ | |||
582 583 584 585 586 587 588 | } } {} do_test pragma-8.2.15 { execsql { PRAGMA user_version; } } {-450} | < > | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | } } {} do_test pragma-8.2.15 { execsql { PRAGMA user_version; } } {-450} } ; # ifcapable schema_version # Test temp_store and temp_store_directory pragmas # ifcapable pager_pragmas { do_test pragma-9.1 { db close sqlite3 db test.db execsql { PRAGMA temp_store; } } {0} |
︙ | ︙ | |||
613 614 615 616 617 618 619 | } {2} do_test pragma-9.4 { execsql { PRAGMA temp_store_directory; } } {} do_test pragma-9.5 { | > | | < | < | | < < | < | < | | | < < | | < | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | } {2} do_test pragma-9.4 { execsql { PRAGMA temp_store_directory; } } {} do_test pragma-9.5 { set pwd [string map {' ''} [pwd]] execsql " PRAGMA temp_store_directory='$pwd'; " } {} do_test pragma-9.6 { execsql { PRAGMA temp_store_directory; } } [pwd] do_test pragma-9.7 { catchsql { PRAGMA temp_store_directory='/NON/EXISTENT/PATH/FOOBAR'; } } {1 {not a writable directory}} do_test pragma-9.8 { execsql { PRAGMA temp_store_directory=''; } } {} do_test pragma-9.9 { execsql { PRAGMA temp_store_directory; PRAGMA temp_store=FILE; CREATE TEMP TABLE temp_store_directory_test(a integer); INSERT INTO temp_store_directory_test values (2); SELECT * FROM temp_store_directory_test; } } {2} do_test pragma-9.10 { catchsql " PRAGMA temp_store_directory='$pwd'; SELECT * FROM temp_store_directory_test; " } {1 {no such table: temp_store_directory_test}} } ;# ifcapable pager_pragmas finish_test |