/ Check-in [65b60f05]
Login

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

Overview
Comment:By default, new databases are now created in the legacy file format - the format that ignores DESC on indices. If you want descending indices, you must either recompile with -DSQLITE_DEFAULT_FILE_FORMAT=4 or issue "PRAGMA legacy_file_format=OFF" prior to creating the first table in the database. (CVS 3330)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 65b60f05ce49ff127bf5044f96db36caf1fa0106
User & Date: drh 2006-07-11 14:17:52
Context
2006-07-12
00:18
Reset TCL results when onecolumn or eval methods have no reply. Ticket #1887. (CVS 3331) check-in: 9c6090c6 user: drh tags: trunk
2006-07-11
14:17
By default, new databases are now created in the legacy file format - the format that ignores DESC on indices. If you want descending indices, you must either recompile with -DSQLITE_DEFAULT_FILE_FORMAT=4 or issue "PRAGMA legacy_file_format=OFF" prior to creating the first table in the database. (CVS 3330) check-in: 65b60f05 user: drh tags: trunk
13:15
Prevent memory leak and possible NULL pointer deference after malloc failure. Ticket #1886. (CVS 3329) check-in: b1f326e6 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.407 2006/06/21 12:36:25 danielk1977 Exp $
           25  +** $Id: build.c,v 1.408 2006/07/11 14:17:52 drh Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
   850    850       /* If the file format and encoding in the database have not been set, 
   851    851       ** set them now.
   852    852       */
   853    853       sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 1);   /* file_format */
   854    854       lbl = sqlite3VdbeMakeLabel(v);
   855    855       sqlite3VdbeAddOp(v, OP_If, 0, lbl);
   856    856       fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ?
   857         -                  1 : SQLITE_DEFAULT_FILE_FORMAT;
          857  +                  1 : SQLITE_MAX_FILE_FORMAT;
   858    858       sqlite3VdbeAddOp(v, OP_Integer, fileFormat, 0);
   859    859       sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 1);
   860    860       sqlite3VdbeAddOp(v, OP_Integer, ENC(db), 0);
   861    861       sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 4);
   862    862       sqlite3VdbeResolveLabel(v, lbl);
   863    863   
   864    864       /* This just creates a place-holder record in the sqlite_master table.

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.351 2006/07/06 10:59:58 drh Exp $
           17  +** $Id: main.c,v 1.352 2006/07/11 14:17:52 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
................................................................................
   841    841     db = sqliteMalloc( sizeof(sqlite3) );
   842    842     if( db==0 ) goto opendb_out;
   843    843     db->priorNewRowid = 0;
   844    844     db->magic = SQLITE_MAGIC_BUSY;
   845    845     db->nDb = 2;
   846    846     db->aDb = db->aDbStatic;
   847    847     db->autoCommit = 1;
   848         -  db->flags |= SQLITE_ShortColNames;
          848  +  db->flags |= SQLITE_ShortColNames
          849  +#if SQLITE_DEFAULT_FILE_FORMAT<4
          850  +                 | SQLITE_LegacyFileFmt
          851  +#endif
          852  +      ;
   849    853     sqlite3HashInit(&db->aFunc, SQLITE_HASH_STRING, 0);
   850    854     sqlite3HashInit(&db->aCollSeq, SQLITE_HASH_STRING, 0);
   851    855   #ifndef SQLITE_OMIT_VIRTUALTABLE
   852    856     sqlite3HashInit(&db->aModule, SQLITE_HASH_STRING, 0);
   853    857   #endif
   854    858   
   855    859     /* Add the default collation sequence BINARY. BINARY works for both UTF-8

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.520 2006/07/11 13:15:08 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.521 2006/07/11 14:17:52 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Extra interface definitions for those who need them
    21     21   */
................................................................................
   144    144   ** The "file format" number is an integer that is incremented whenever
   145    145   ** the VDBE-level file format changes.  The following macros define the
   146    146   ** the default file format for new databases and the maximum file format
   147    147   ** that the library can read.
   148    148   */
   149    149   #define SQLITE_MAX_FILE_FORMAT 4
   150    150   #ifndef SQLITE_DEFAULT_FILE_FORMAT
   151         -# define SQLITE_DEFAULT_FILE_FORMAT 4
          151  +# define SQLITE_DEFAULT_FILE_FORMAT 1
   152    152   #endif
   153    153   
   154    154   /*
   155    155   ** Provide a default value for TEMP_STORE in case it is not specified
   156    156   ** on the command-line
   157    157   */
   158    158   #ifndef TEMP_STORE

Changes to test/descidx1.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is descending indices.
    13     13   #
    14         -# $Id: descidx1.test,v 1.6 2006/06/27 12:51:13 drh Exp $
           14  +# $Id: descidx1.test,v 1.7 2006/07/11 14:17:52 drh Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20         -ifcapable legacyformat {
    21         -  finish_test
    22         -  return
    23         -}
           20  +db eval {PRAGMA legacy_file_format=OFF}
    24     21   
    25     22   # This procedure sets the value of the file-format in file 'test.db'
    26     23   # to $newval. Also, the schema cookie is incremented.
    27     24   # 
    28     25   proc set_file_format {newval} {
    29     26     set bt [btree_open test.db 10 0]
    30     27     btree_begin_transaction $bt
................................................................................
   293    290       SELECT a||b||c FROM t3 WHERE d=0 ORDER BY a DESC, b DESC, c ASC
   294    291     }
   295    292   } {110 111 100 101 010 011 000 001 sort}
   296    293   
   297    294   # Test the legacy_file_format pragma here because we have access to
   298    295   # the get_file_format command.
   299    296   #
   300         -do_test descidx1-6.1 {
   301         -  db close
   302         -  file delete -force test.db test.db-journal
   303         -  sqlite3 db test.db
   304         -  execsql {PRAGMA legacy_file_format}
   305         -} {0}
          297  +ifcapable legacyformat {
          298  +  do_test descidx1-6.1 {
          299  +    db close
          300  +    file delete -force test.db test.db-journal
          301  +    sqlite3 db test.db
          302  +    execsql {PRAGMA legacy_file_format}
          303  +  } {1}
          304  +} else {
          305  +  do_test descidx1-6.1 {
          306  +    db close
          307  +    file delete -force test.db test.db-journal
          308  +    sqlite3 db test.db
          309  +    execsql {PRAGMA legacy_file_format}
          310  +  } {0}
          311  +}
   306    312   do_test descidx1-6.2 {
   307    313     execsql {PRAGMA legacy_file_format=YES}
   308    314     execsql {PRAGMA legacy_file_format}
   309    315   } {1}
   310    316   do_test descidx1-6.3 {
   311    317     execsql {
   312    318       CREATE TABLE t1(a,b,c);
   313    319     }
   314    320     get_file_format
   315    321   } {1}
          322  +do_test descidx1-6.4 {
          323  +  db close
          324  +  file delete -force test.db test.db-journal
          325  +  sqlite3 db test.db
          326  +  execsql {PRAGMA legacy_file_format=NO}
          327  +  execsql {PRAGMA legacy_file_format}
          328  +} {0}
          329  +do_test descidx1-6.5 {
          330  +  execsql {
          331  +    CREATE TABLE t1(a,b,c);
          332  +  }
          333  +  get_file_format
          334  +} {4}
   316    335   
   317    336   
   318    337   finish_test

Changes to test/descidx2.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is descending indices.
    13     13   #
    14         -# $Id: descidx2.test,v 1.3 2006/06/27 12:51:13 drh Exp $
           14  +# $Id: descidx2.test,v 1.4 2006/07/11 14:17:52 drh Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20         -ifcapable legacyformat {
    21         -  finish_test
    22         -  return
    23         -}
           20  +db eval {PRAGMA legacy_file_format=OFF}
    24     21   
    25     22   # This procedure sets the value of the file-format in file 'test.db'
    26     23   # to $newval. Also, the schema cookie is incremented.
    27     24   # 
    28     25   proc set_file_format {newval} {
    29     26     set bt [btree_open test.db 10 0]
    30     27     btree_begin_transaction $bt

Changes to test/descidx3.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is descending indices.
    13     13   #
    14         -# $Id: descidx3.test,v 1.4 2006/06/27 12:51:13 drh Exp $
           14  +# $Id: descidx3.test,v 1.5 2006/07/11 14:17:52 drh Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20         -ifcapable {!bloblit || legacyformat} {
           20  +ifcapable !bloblit {
    21     21     finish_test
    22     22     return
    23     23   }
           24  +db eval {PRAGMA legacy_file_format=OFF}
    24     25   
    25     26   # This procedure sets the value of the file-format in file 'test.db'
    26     27   # to $newval. Also, the schema cookie is incremented.
    27     28   # 
    28     29   proc set_file_format {newval} {
    29     30     set bt [btree_open test.db 10 0]
    30     31     btree_begin_transaction $bt

Changes to test/format4.test.

    13     13   # This file implements tests to verify that the new serial_type
    14     14   # values of 8 (integer 0) and 9 (integer 1) work correctly.
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20         -ifcapable legacyformat {
    21         -  finish_test
    22         -  return
    23         -}
           20  +db eval {PRAGMA legacy_file_format=OFF}
    24     21   
    25     22   # The size of the database depends on whether or not autovacuum
    26     23   # is enabled.
    27     24   #
    28     25   if {[db one {PRAGMA auto_vacuum}]} {
    29     26     set small 3072
    30     27     set large 5120