/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
890
891
892
893
894
895
896

897
898
899
900
901
902
903
**    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.125 2006/11/30 13:06:37 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
................................................................................
        { OP_ReadCookie,      0,  0,  0},    /* 0 */
        { OP_Callback,        1,  0,  0}
      };
      int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie);
      sqlite3VdbeChangeP1(v, addr, iDb);
      sqlite3VdbeChangeP2(v, addr, iCookie);
      sqlite3VdbeSetNumCols(v, 1);

    }
  }
#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */

#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
  /*
  ** Report the current state of file logs for all databases







|







 







>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
**    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.126 2007/01/04 22:13:42 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
................................................................................
        { OP_ReadCookie,      0,  0,  0},    /* 0 */
        { OP_Callback,        1,  0,  0}
      };
      int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie);
      sqlite3VdbeChangeP1(v, addr, iDb);
      sqlite3VdbeChangeP2(v, addr, iCookie);
      sqlite3VdbeSetNumCols(v, 1);
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, P3_TRANSIENT);
    }
  }
#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */

#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
  /*
  ** Report the current state of file logs for all databases

Changes to test/pragma.test.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
...
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
#    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.45 2006/11/30 13:06:37 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.
................................................................................
  return
}

# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db

sqlite3 db test.db; set DB [sqlite3_connection_pointer db]

ifcapable pager_pragmas {
do_test pragma-1.1 {
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
................................................................................
# same value.
do_test pragma-8.1.1 {
  execsql {
    PRAGMA schema_version = 105;
  }
} {}
do_test pragma-8.1.2 {
  execsql {
    PRAGMA schema_version;
  }
} 105
do_test pragma-8.1.3 {
  execsql {
    PRAGMA schema_version = 106;
  }
} {}
do_test pragma-8.1.4 {
  execsql {
................................................................................
do_test pragma-8.1.18 {
  db2 close
} {}

# Now test that the user-version can be read and written (and that we aren't
# accidentally manipulating the schema-version instead).
do_test pragma-8.2.1 {
  execsql {
    PRAGMA user_version;
  }
} {0}
do_test pragma-8.2.2 {
  execsql {
    PRAGMA user_version = 2;
  }
} {}
do_test pragma-8.2.3.1 {
  execsql {
    PRAGMA user_version;
  }
} {2}
do_test pragma-8.2.3.2 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA user_version;
  }
} {2}







|







 







|
>







 







|


|







 







|


|






|


|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
...
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
#    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.46 2007/01/04 22:13:42 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.
................................................................................
  return
}

# Delete the preexisting database to avoid the special setup
# that the "all.test" script does.
#
db close
file delete test.db test.db-journal
file delete test3.db test3.db-journal
sqlite3 db test.db; set DB [sqlite3_connection_pointer db]

ifcapable pager_pragmas {
do_test pragma-1.1 {
  execsql {
    PRAGMA cache_size;
    PRAGMA default_cache_size;
................................................................................
# same value.
do_test pragma-8.1.1 {
  execsql {
    PRAGMA schema_version = 105;
  }
} {}
do_test pragma-8.1.2 {
  execsql2 {
    PRAGMA schema_version;
  }
} {schema_version 105}
do_test pragma-8.1.3 {
  execsql {
    PRAGMA schema_version = 106;
  }
} {}
do_test pragma-8.1.4 {
  execsql {
................................................................................
do_test pragma-8.1.18 {
  db2 close
} {}

# Now test that the user-version can be read and written (and that we aren't
# accidentally manipulating the schema-version instead).
do_test pragma-8.2.1 {
  execsql2 {
    PRAGMA user_version;
  }
} {user_version 0}
do_test pragma-8.2.2 {
  execsql {
    PRAGMA user_version = 2;
  }
} {}
do_test pragma-8.2.3.1 {
  execsql2 {
    PRAGMA user_version;
  }
} {user_version 2}
do_test pragma-8.2.3.2 {
  db close
  sqlite3 db test.db
  execsql {
    PRAGMA user_version;
  }
} {2}