/ Check-in [4cd4efaf]
Login

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

Overview
Comment:Expire all prepared statements whenever there is a change to the schema of the TEMP database. Ticket #1644. (CVS 3036)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4cd4efaf5ef40a07e76fba3073bbd2600ca7e327
User & Date: drh 2006-01-30 15:34:23
Context
2006-01-30
15:41
Add a couple of extra test cases for #1644. (CVS 3037) check-in: e10d229f user: danielk1977 tags: trunk
15:34
Expire all prepared statements whenever there is a change to the schema of the TEMP database. Ticket #1644. (CVS 3036) check-in: 4cd4efaf user: drh tags: trunk
14:36
Fix bug with CHECK constraints contain an IN operator. Ticket #1645. (CVS 3035) check-in: 944df310 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
2459
2460
2461
2462
2463
2464
2465





2466
2467
2468
2469
2470
2471
2472
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.539 2006/01/24 13:09:33 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
................................................................................
    db->flags |= SQLITE_InternChanges;
  }else if( pOp->p2==1 ){
    /* Record changes in the file format */
    pDb->pSchema->file_format = pTos->i;
  }
  assert( (pTos->flags & MEM_Dyn)==0 );
  pTos--;





  break;
}

/* Opcode: VerifyCookie P1 P2 *
**
** Check the value of global database parameter number 0 (the
** schema version) and make sure it is equal to P2.  







|







 







>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.540 2006/01/30 15:34:23 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
................................................................................
    db->flags |= SQLITE_InternChanges;
  }else if( pOp->p2==1 ){
    /* Record changes in the file format */
    pDb->pSchema->file_format = pTos->i;
  }
  assert( (pTos->flags & MEM_Dyn)==0 );
  pTos--;
  if( pOp->p1==1 ){
    /* Invalidate all prepared statements whenever the TEMP database
    ** schema is changed.  Ticket #1644 */
    sqlite3ExpirePreparedStatements(db);
  }
  break;
}

/* Opcode: VerifyCookie P1 P2 *
**
** Check the value of global database parameter number 0 (the
** schema version) and make sure it is equal to P2.  

Added test/tkt1644.test.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 2006 January 30
#
# 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 implements regression tests for SQLite library.
#
# This file implements tests to verify that ticket #1644 is
# fixed.  Ticket #1644 complains that precompiled statements
# are not expired correctly as a result of changes to TEMP
# views and triggers.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Create two tables T1 and T2 and make V1 point to T1.
do_test tkt1644-1.1 {
  execsql {
    CREATE TABLE t1(a);
    INSERT INTO t1 VALUES(1);
    CREATE TABLE t2(b);
    INSERT INTO t2 VALUES(99);
    CREATE TEMP VIEW v1 AS SELECT * FROM t1;
    SELECT * FROM v1;
  }
} {1}

# The "SELECT * FROM v1" should be in the TCL interface cache below.
# It will continue to point to T1 unless the cache is invalidated when
# the view changes.
#
do_test tkt1644-1.2 {
  execsql {
    DROP VIEW v1;
    CREATE TEMP VIEW v1 AS SELECT * FROM t2;
    SELECT * FROM v1;
  }
} {99}

# Cache an access to the T1 table.
#
do_test tkt1644-1.3 {
  execsql {
    SELECT * FROM t1;
  }
} {1}

# Create a temp table T1.  Make sure the cache is invalidated so that
# the statement is recompiled and refers to the empty temp table.
#
do_test tkt1644-1.4 {
  execsql {
    CREATE TEMP TABLE t1(x);
  }
  execsql {
    SELECT * FROM t1;
  }
} {}


finish_test