Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Check the value of the schema cookie before reading the sqlite_master table. (CVS 1585) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
80c299f8839d920c61854f575498340b |
User & Date: | danielk1977 2004-06-14 08:26:35.000 |
Context
2004-06-14
| ||
09:35 | Ensure master journal file is deleted when a transaction is committed. (CVS 1586) (check-in: cb3cbe00be user: danielk1977 tags: trunk) | |
08:26 | Check the value of the schema cookie before reading the sqlite_master table. (CVS 1585) (check-in: 80c299f883 user: danielk1977 tags: trunk) | |
06:13 | Change tests in pager.test to account for the extra cache hit in the code that updates file change counter. (CVS 1584) (check-in: 76ac9a787b user: danielk1977 tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. ** ** $Id: where.c,v 1.105 2004/06/14 08:26:35 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** The query generator uses an array of instances of this structure to ** help it analyze the subexpressions of the WHERE clause. Each WHERE ** clause subexpression is separated from the others by an AND operator. |
︙ | ︙ | |||
699 700 701 702 703 704 705 | Index *pIx; pTab = pTabList->a[i].pTab; if( pTab->isTransient || pTab->pSelect ) continue; sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0); sqlite3VdbeAddOp(v, OP_OpenRead, pTabList->a[i].iCursor, pTab->tnum); sqlite3VdbeAddOp(v, OP_SetNumColumns, pTabList->a[i].iCursor, pTab->nCol); | < | < | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | Index *pIx; pTab = pTabList->a[i].pTab; if( pTab->isTransient || pTab->pSelect ) continue; sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0); sqlite3VdbeAddOp(v, OP_OpenRead, pTabList->a[i].iCursor, pTab->tnum); sqlite3VdbeAddOp(v, OP_SetNumColumns, pTabList->a[i].iCursor, pTab->nCol); sqlite3CodeVerifySchema(pParse, pTab->iDb); if( (pIx = pWInfo->a[i].pIdx)!=0 ){ sqlite3VdbeAddOp(v, OP_Integer, pIx->iDb, 0); sqlite3VdbeOp3(v, OP_OpenRead, pWInfo->a[i].iCur, pIx->tnum, (char*)&pIx->keyInfo, P3_KEYINFO); } } |
︙ | ︙ |
Changes to test/enc2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. The focus of # this file is testing the SQLite routines used for converting between the # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # | | > > > > > > > > > > > > | 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 | # #*********************************************************************** # This file implements regression tests for SQLite library. The focus of # this file is testing the SQLite routines used for converting between the # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # # $Id: enc2.test,v 1.10 2004/06/14 08:26:37 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # The rough organisation of tests in this file is: # # enc2.1.*: Simple tests with a UTF-8 db. # enc2.2.*: Simple tests with a UTF-16LE db. # enc2.3.*: Simple tests with a UTF-16BE db. # enc2.4.*: Test that attached databases must have the same text encoding # as the main database. # enc2.5.*: Test the behaviour of the library when a collation sequence is # not available for the most desirable text encoding. # enc2.6.*: Test that the VerifyCookie opcode protects against assuming the # wrong text encoding for the database. db close # Return the UTF-8 representation of the supplied UTF-16 string $str. proc utf8 {str} { # If $str ends in two 0x00 0x00 bytes, knock these off before # converting to UTF-8 using TCL. |
︙ | ︙ | |||
247 248 249 250 251 252 253 254 255 | } {one two three four five UTF-16LE} breakpoint do_test enc2-5.11 { add_test_collate $DB 1 0 0 set res [execsql {SELECT * FROM t5 ORDER BY 1 COLLATE test_collate}] lappend res $::test_collate_enc } {one two three four five UTF-8} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | } {one two three four five UTF-16LE} breakpoint do_test enc2-5.11 { add_test_collate $DB 1 0 0 set res [execsql {SELECT * FROM t5 ORDER BY 1 COLLATE test_collate}] lappend res $::test_collate_enc } {one two three four five UTF-8} db close file delete -force test.db # The following tests - enc2-6.* - function as follows: # # 1: Open an empty database file assuming UTF-16 encoding. # 2: Open the same database with a different handle assuming UTF-8. Create # a table using this handle. # 3: Read the sqlite_master table from the first handle. # 4: Ensure the first handle recognises the database encoding is UTF-8. # do_test enc2-6.1 { sqlite db test.db execsql { PRAGMA encoding = 'UTF-16'; SELECT * FROM sqlite_master; } } {} do_test enc2-6.2 { set enc [execsql { PRAGMA encoding; }] string range $enc 0 end-2 ;# Chop off the "le" or "be" } {UTF-16} do_test enc2-6.3 { sqlite db2 test.db execsql { PRAGMA encoding = 'UTF-8'; CREATE TABLE abc(a, b, c); } db2 } {} do_test enc2-6.4 { execsql { SELECT * FROM sqlite_master; } } {table abc abc 2 {CREATE TABLE abc(a, b, c)}} do_test enc2-6.5 { execsql { PRAGMA encoding; } } {UTF-8} db close db2 close finish_test |
Changes to test/lock.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # 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. The # focus of this script is database locks. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # 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. The # focus of this script is database locks. # # $Id: lock.test,v 1.25 2004/06/14 08:26:37 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create an alternative connection to the database # |
︙ | ︙ | |||
39 40 41 42 43 44 45 | } db2 } {0 t1} do_test lock-1.6 { execsql {INSERT INTO t1 VALUES(1,2)} execsql {SELECT * FROM t1} } {1 2} | > | | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | } db2 } {0 t1} do_test lock-1.6 { execsql {INSERT INTO t1 VALUES(1,2)} execsql {SELECT * FROM t1} } {1 2} # Update: The schema is now brought up to date by test lock-1.5. # do_test lock-1.7.1 { # catchsql {SELECT * FROM t1} db2 # } {1 {no such table: t1}} do_test lock-1.7.2 { catchsql {SELECT * FROM t1} db2 } {0 {1 2}} do_test lock-1.8 { execsql {UPDATE t1 SET a=b, b=a} db2 execsql {SELECT * FROM t1} db2 } {2 1} |
︙ | ︙ |
Changes to test/temptable.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for temporary tables and indices. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for temporary tables and indices. # # $Id: temptable.test,v 1.13 2004/06/14 08:26:37 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create an alternative connection to the database # do_test temptable-1.0 { |
︙ | ︙ | |||
233 234 235 236 237 238 239 | } } {3 4} do_test temptable-4.10.1 { catchsql { SELECT * FROM t2; } db2 } {0 {1 2}} | > > | | | | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | } } {3 4} do_test temptable-4.10.1 { catchsql { SELECT * FROM t2; } db2 } {0 {1 2}} # Update: The schema is reloaded in test temptable-4.10.1. And tclsqlite.c # handles it and retries the query anyway. # do_test temptable-4.10.2 { # catchsql { # SELECT name FROM sqlite_master WHERE type='table' # } db2 # } {1 {database schema has changed}} do_test temptable-4.10.3 { catchsql { SELECT name FROM sqlite_master WHERE type='table' } db2 } {0 {t1 t2}} do_test temptable-4.11 { execsql { |
︙ | ︙ |
Changes to test/thread1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2003 December 18 # # 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. The # focus of this script is multithreading behavior # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2003 December 18 # # 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. The # focus of this script is multithreading behavior # # $Id: thread1.test,v 1.6 2004/06/14 08:26:37 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Skip this whole file if the thread testing code is not enabled # |
︙ | ︙ | |||
92 93 94 95 96 97 98 | } SQLITE_OK do_test thread1-1.12 { catchsql {SELECT name FROM sqlite_master} execsql {SELECT name FROM sqlite_master} } {t1 t2} | > | | | > > | > > | < > | > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | } SQLITE_OK do_test thread1-1.12 { catchsql {SELECT name FROM sqlite_master} execsql {SELECT name FROM sqlite_master} } {t1 t2} # # The following tests - thread1-2.* - test the following scenario: # # 1: Read-lock thread A # 2: Read-lock thread B # 3: Attempt to write in thread C -> SQLITE_BUSY # 4: Check db write failed from main thread. # 5: Unlock from thread A. # 6: Attempt to write in thread C -> SQLITE_BUSY # 7: Check db write failed from main thread. # 8: Unlock from thread B. # 9: Attempt to write in thread C -> SQLITE_DONE # 10: Finalize the write from thread C # 11: Check db write succeeded from main thread. # do_test thread1-2.1 { thread_halt * thread_create A test.db thread_compile A {SELECT a FROM t1} thread_step A thread_result A |
︙ | ︙ |