/ Check-in [bb558945]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug that was preventing "PRAGMA temp_store=MEMORY" from working. (CVS 1887)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bb55894521848b6a9d8b516a3c7eeb3482936d7e
User & Date: drh 2004-08-14 18:34:55
Context
2004-08-14
19:20
If meta(3)>0 then make the database readonly for now. This allows the current database to interact with future releases that might include autovacuum. (CVS 1888) check-in: 7619bf47 user: drh tags: trunk
18:34
Fix a bug that was preventing "PRAGMA temp_store=MEMORY" from working. (CVS 1887) check-in: bb558945 user: drh tags: trunk
18:18
The command-line shell should avoid writing changes into string constants. (CVS 1886) check-in: 6b8178de user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/main.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: main.c,v 1.249 2004/08/01 00:10:45 drh Exp $
           17  +** $Id: main.c,v 1.250 2004/08/14 18:34:55 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** The following constant value is used by the SQLITE_BIGENDIAN and
................................................................................
   813    813     const char *zFilename,    /* Name of the file containing the BTree database */
   814    814     int omitJournal,          /* if TRUE then do not journal this file */
   815    815     int nCache,               /* How many pages in the page cache */
   816    816     Btree **ppBtree           /* Pointer to new Btree object written here */
   817    817   ){
   818    818     int btree_flags = 0;
   819    819     int rc;
   820         -  int useMem = 0;
   821    820     
   822    821     assert( ppBtree != 0);
   823    822     if( omitJournal ){
   824    823       btree_flags |= BTREE_OMIT_JOURNAL;
   825    824     }
   826    825     if( zFilename==0 ){
   827    826   #ifndef TEMP_STORE
   828         -# define TEMP_STORE 2
          827  +# define TEMP_STORE 1
   829    828   #endif
   830    829   #if TEMP_STORE==0
   831         -    useMem = 0;
          830  +    /* Do nothing */
   832    831   #endif
   833    832   #if TEMP_STORE==1
   834         -    useMem = db->temp_store==2;
          833  +    if( db->temp_store==2 ) zFilename = ":memory:";
   835    834   #endif
   836    835   #if TEMP_STORE==2
   837         -    useMem = db->temp_store!=1;
          836  +    if( db->temp_store!=1 ) zFilename = ":memory:";
   838    837   #endif
   839    838   #if TEMP_STORE==3
   840         -    useMem = 1;
          839  +    zFilename = ":memory:";
   841    840   #endif
   842    841     }
   843         -  if( (zFilename && strcmp(zFilename, ":memory:")==0)
   844         -         || (zFilename==0 && useMem) ){
   845         -    btree_flags |= BTREE_MEMORY;
   846         -  }
   847    842   
   848    843     rc = sqlite3BtreeOpen(zFilename, ppBtree, btree_flags);
   849    844     if( rc==SQLITE_OK ){
   850    845       sqlite3BtreeSetBusyHandler(*ppBtree, (void*)&db->busyHandler);
   851    846       sqlite3BtreeSetCacheSize(*ppBtree, nCache);
   852    847     }
   853    848     return rc;