/ Check-in [f81c4227]
Login

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

Overview
Comment:Fix the user_version and schema_version pragmas so that they set a result column name. Ticket #2143. (CVS 3560)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f81c4227c26a4d43993904ab05c1eb9f988e3b66
User & Date: drh 2007-01-04 22:13:42
Context
2007-01-05
00:14
Fix a test case that changed due to (3560). Ticket #2143 (CVS 3561) check-in: c28664d3 user: drh tags: trunk
2007-01-04
22:13
Fix the user_version and schema_version pragmas so that they set a result column name. Ticket #2143. (CVS 3560) check-in: f81c4227 user: drh tags: trunk
22:13
Fix the trigger4 test so that it runs on windows. (CVS 3559) check-in: 5e4e65ea user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

     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   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.125 2006/11/30 13:06:37 drh Exp $
           14  +** $Id: pragma.c,v 1.126 2007/01/04 22:13:42 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include "os.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /* Ignore this whole file if pragmas are disabled
    21     21   */
................................................................................
   890    890           { OP_ReadCookie,      0,  0,  0},    /* 0 */
   891    891           { OP_Callback,        1,  0,  0}
   892    892         };
   893    893         int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie);
   894    894         sqlite3VdbeChangeP1(v, addr, iDb);
   895    895         sqlite3VdbeChangeP2(v, addr, iCookie);
   896    896         sqlite3VdbeSetNumCols(v, 1);
          897  +      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, P3_TRANSIENT);
   897    898       }
   898    899     }
   899    900   #endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
   900    901   
   901    902   #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
   902    903     /*
   903    904     ** Report the current state of file logs for all databases

Changes to test/pragma.test.

     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.
    12     12   #
    13     13   # This file implements tests for the PRAGMA command.
    14     14   #
    15         -# $Id: pragma.test,v 1.45 2006/11/30 13:06:37 drh Exp $
           15  +# $Id: pragma.test,v 1.46 2007/01/04 22:13:42 drh Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Test organization:
    21     21   #
    22     22   # pragma-1.*: Test cache_size, default_cache_size and synchronous on main db.
................................................................................
    38     38     return
    39     39   }
    40     40   
    41     41   # Delete the preexisting database to avoid the special setup
    42     42   # that the "all.test" script does.
    43     43   #
    44     44   db close
    45         -file delete test.db
           45  +file delete test.db test.db-journal
           46  +file delete test3.db test3.db-journal
    46     47   sqlite3 db test.db; set DB [sqlite3_connection_pointer db]
    47     48   
    48     49   ifcapable pager_pragmas {
    49     50   do_test pragma-1.1 {
    50     51     execsql {
    51     52       PRAGMA cache_size;
    52     53       PRAGMA default_cache_size;
................................................................................
   442    443   # same value.
   443    444   do_test pragma-8.1.1 {
   444    445     execsql {
   445    446       PRAGMA schema_version = 105;
   446    447     }
   447    448   } {}
   448    449   do_test pragma-8.1.2 {
   449         -  execsql {
          450  +  execsql2 {
   450    451       PRAGMA schema_version;
   451    452     }
   452         -} 105
          453  +} {schema_version 105}
   453    454   do_test pragma-8.1.3 {
   454    455     execsql {
   455    456       PRAGMA schema_version = 106;
   456    457     }
   457    458   } {}
   458    459   do_test pragma-8.1.4 {
   459    460     execsql {
................................................................................
   544    545   do_test pragma-8.1.18 {
   545    546     db2 close
   546    547   } {}
   547    548   
   548    549   # Now test that the user-version can be read and written (and that we aren't
   549    550   # accidentally manipulating the schema-version instead).
   550    551   do_test pragma-8.2.1 {
   551         -  execsql {
          552  +  execsql2 {
   552    553       PRAGMA user_version;
   553    554     }
   554         -} {0}
          555  +} {user_version 0}
   555    556   do_test pragma-8.2.2 {
   556    557     execsql {
   557    558       PRAGMA user_version = 2;
   558    559     }
   559    560   } {}
   560    561   do_test pragma-8.2.3.1 {
   561         -  execsql {
          562  +  execsql2 {
   562    563       PRAGMA user_version;
   563    564     }
   564         -} {2}
          565  +} {user_version 2}
   565    566   do_test pragma-8.2.3.2 {
   566    567     db close
   567    568     sqlite3 db test.db
   568    569     execsql {
   569    570       PRAGMA user_version;
   570    571     }
   571    572   } {2}