SQLite

Check-in [8724847036]
Login

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

Overview
Comment:Fix a bug in sqlite3_prepare_v2() introduced by checkin (3578) and reported on the mailing list. (CVS 3592)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 87248470362f444f2339fee18d3624e8544f5256
User & Date: drh 2007-01-12 23:43:43.000
Context
2007-01-16
03:09
Make sure the parser generated by lemon always calls destructors on unused symbols, even if there is no action following the rule. Ticket #2171. (CVS 3593) (check-in: 0c5c1b931d user: drh tags: trunk)
2007-01-12
23:43
Fix a bug in sqlite3_prepare_v2() introduced by checkin (3578) and reported on the mailing list. (CVS 3592) (check-in: 8724847036 user: drh tags: trunk)
23:09
Fix a bug in lemon. The code in which the error appears might well be unreachable. The changes does not effect the code that is generated for the SQLite parser. Ticket #2164. (CVS 3591) (check-in: f4ee5d83e1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbe.c.
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
**
** 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.585 2007/01/09 14:01:14 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*







|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
**
** 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.586 2007/01/12 23:43:43 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
2513
2514
2515
2516
2517
2518
2519


2520
2521
2522
2523
2524
2525
2526
    rc = sqlite3BtreeGetMeta(pBt, 1, (u32 *)&iMeta);
  }else{
    rc = SQLITE_OK;
    iMeta = 0;
  }
  if( rc==SQLITE_OK && iMeta!=pOp->p2 ){
    sqlite3SetString(&p->zErrMsg, "database schema has changed", (char*)0);


    rc = SQLITE_SCHEMA;
  }
  break;
}

/* Opcode: OpenRead P1 P2 P3
**







>
>







2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
    rc = sqlite3BtreeGetMeta(pBt, 1, (u32 *)&iMeta);
  }else{
    rc = SQLITE_OK;
    iMeta = 0;
  }
  if( rc==SQLITE_OK && iMeta!=pOp->p2 ){
    sqlite3SetString(&p->zErrMsg, "database schema has changed", (char*)0);
    sqlite3ResetInternalSchema(db, pOp->p1);
    sqlite3ExpirePreparedStatements(db);
    rc = SQLITE_SCHEMA;
  }
  break;
}

/* Opcode: OpenRead P1 P2 P3
**
Changes to test/capi3c.test.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.  
#
# This is a copy of the capi3.test file that has been adapted to
# test the new sqlite3_prepare_v2 interface.
#
# $Id: capi3c.test,v 1.5 2007/01/09 15:06:42 drh Exp $
#

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

# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.  
#
# This is a copy of the capi3.test file that has been adapted to
# test the new sqlite3_prepare_v2 interface.
#
# $Id: capi3c.test,v 1.6 2007/01/12 23:43:43 drh Exp $
#

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

# Return the UTF-16 representation of the supplied UTF-8 string $str.
# If $nt is true, append two 0x00 bytes as a nul terminator.
1186
1187
1188
1189
1190
1191
1192




















1193
1194
1195
1196
  }
  sqlite3_step $STMT
} SQLITE_ROW
do_test capi3c-19.6 {
  sqlite3_column_int $STMT 1
} 2
do_test capi3c-19.99 {




















  sqlite3_finalize $STMT
} SQLITE_OK

finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
  }
  sqlite3_step $STMT
} SQLITE_ROW
do_test capi3c-19.6 {
  sqlite3_column_int $STMT 1
} 2
do_test capi3c-19.99 {
  sqlite3_finalize $STMT
} SQLITE_OK

# Make sure a change in a separate database connection does not
# cause an SQLITE_SCHEMA return.
#
do_test capi3c-20.1 {
  set STMT [sqlite3_prepare_v2 $DB {SELECT * FROM t3} -1 TAIL]
  sqlite3 db2 test.db
  db2 eval {CREATE TABLE t4(x)}
  sqlite3_step $STMT
} SQLITE_ROW
do_test capi3c-20.2 {
  sqlite3_column_int $STMT 1
} 2
do_test capi3c-20.3 {
  sqlite3_step $STMT
} SQLITE_DONE
do_test capi3c-20.4 {
  db2 close
  sqlite3_finalize $STMT
} SQLITE_OK

finish_test