Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Return code was being dropped because of overridden variable in OP_IsUnique. Fix this and the test logic problem that hid it. (CVS 3025) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c30705a00d7d9d61fb9cb47a1019b1a1 |
User & Date: | danielk1977 2006-01-24 13:09:33.000 |
Context
2006-01-24
| ||
14:21 | Save the position of any open cursors before a rollback. (CVS 3026) (check-in: 32d45bcf74 user: danielk1977 tags: trunk) | |
13:09 | Return code was being dropped because of overridden variable in OP_IsUnique. Fix this and the test logic problem that hid it. (CVS 3025) (check-in: c30705a00d user: danielk1977 tags: trunk) | |
12:09 | Rename some variables to avoid hiding others. Also add "static" to two function signatures that were missing it. (CVS 3024) (check-in: d86f18a427 user: danielk1977 tags: trunk) | |
Changes
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.330 2006/01/24 13:09:33 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** The following constant value is used by the SQLITE_BIGENDIAN and |
︙ | ︙ | |||
1084 1085 1086 1087 1088 1089 1090 | ** current thread. ** ** This routine should only be called when there are no open ** database connections. */ int sqlite3_enable_shared_cache(int enable){ ThreadData *pTd = sqlite3ThreadData(); | | < < < | | | | | | | | | | | > | | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | ** current thread. ** ** This routine should only be called when there are no open ** database connections. */ int sqlite3_enable_shared_cache(int enable){ ThreadData *pTd = sqlite3ThreadData(); if( pTd ){ /* It is only legal to call sqlite3_enable_shared_cache() when there ** are no currently open b-trees that were opened by the calling thread. ** This condition is only easy to detect if the shared-cache were ** previously enabled (and is being disabled). */ if( pTd->pBtree && !enable ){ assert( pTd->useSharedData ); return SQLITE_MISUSE; } pTd->useSharedData = enable; sqlite3ReleaseThreadData(); } return sqlite3ApiExit(0, SQLITE_OK); } #endif /* ** This is a convenience routine that makes sure that all thread-specific ** data for this thread has been deallocated. */ |
︙ | ︙ |
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.256 2006/01/24 13:09:33 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include "os.h" #include "pager.h" #include <assert.h> #include <string.h> |
︙ | ︙ | |||
1774 1775 1776 1777 1778 1779 1780 1781 1782 | ** these cases sqlite3OsRead() will return an error, to which the correct ** response is to zero the memory at pDest and continue. A real IO error ** will presumably recur and be picked up later (Todo: Think about this). */ void sqlite3pager_read_fileheader(Pager *pPager, int N, unsigned char *pDest){ memset(pDest, 0, N); if( MEMDB==0 ){ sqlite3OsSeek(pPager->fd, 0); sqlite3OsRead(pPager->fd, pDest, N); | > | | 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 | ** these cases sqlite3OsRead() will return an error, to which the correct ** response is to zero the memory at pDest and continue. A real IO error ** will presumably recur and be picked up later (Todo: Think about this). */ void sqlite3pager_read_fileheader(Pager *pPager, int N, unsigned char *pDest){ memset(pDest, 0, N); if( MEMDB==0 ){ disable_simulated_io_errors(); sqlite3OsSeek(pPager->fd, 0); sqlite3OsRead(pPager->fd, pDest, N); enable_simulated_io_errors(); } } /* ** Return the total number of pages in the disk file associated with ** pPager. ** |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** 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. ** | | | 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.539 2006/01/24 13:09:33 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
2967 2968 2969 2970 2971 2972 2973 | assert( (pTos->flags & MEM_Dyn)==0 ); pTos--; assert( i>=0 && i<=p->nCursor ); pCx = p->apCsr[i]; assert( pCx!=0 ); pCrsr = pCx->pCursor; if( pCrsr!=0 ){ | | | 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 | assert( (pTos->flags & MEM_Dyn)==0 ); pTos--; assert( i>=0 && i<=p->nCursor ); pCx = p->apCsr[i]; assert( pCx!=0 ); pCrsr = pCx->pCursor; if( pCrsr!=0 ){ int res; i64 v; /* The record number on the P1 entry that matches K */ char *zKey; /* The value of K */ int nKey; /* Number of bytes in K */ int len; /* Number of bytes in K without the rowid at the end */ int szRowid; /* Size of the rowid column at the end of zKey */ /* Make sure K is a string and make zKey point to K |
︙ | ︙ |
Changes to test/ioerr.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # This file implements regression tests for SQLite library. The # focus of this file is testing for correct handling of I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # This file implements regression tests for SQLite library. The # focus of this file is testing for correct handling of I/O errors # such as writes failing because the disk is full. # # The tests in this file use special facilities that are only # available in the SQLite test fixture. # # $Id: ioerr.test,v 1.25 2006/01/24 13:09:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # If SQLITE_DEFAULT_AUTOVACUUM is set to true, then a simulated IO error # on the 8th IO operation in the SQL script below doesn't report an error. |
︙ | ︙ | |||
40 41 42 43 44 45 46 | SELECT * FROM t1; BEGIN TRANSACTION; INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(4,5,6); COMMIT; SELECT * FROM t1; DELETE FROM t1 WHERE a<100; | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | SELECT * FROM t1; BEGIN TRANSACTION; INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(4,5,6); COMMIT; SELECT * FROM t1; DELETE FROM t1 WHERE a<100; } -exclude [expr [string match [execsql {pragma auto_vacuum}] 1] ? 4 : 0] # Test for IO errors during a VACUUM. # # The first IO call is excluded from the test. This call attempts to read # the file-header of the temporary database used by VACUUM. Since the # database doesn't exist at that point, the IO error is not detected. # |
︙ | ︙ | |||
71 72 73 74 75 76 77 | CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t3 AS SELECT * FROM t1; COMMIT; DROP TABLE t2; } -sqlbody { VACUUM; } -exclude [list \ | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | CREATE TABLE t2 AS SELECT * FROM t1; CREATE TABLE t3 AS SELECT * FROM t1; COMMIT; DROP TABLE t2; } -sqlbody { VACUUM; } -exclude [list \ 1 [expr [string match [execsql {pragma auto_vacuum}] 1]?9:-1]] } do_ioerr_test ioerr-3 -tclprep { execsql { PRAGMA cache_size = 10; BEGIN; CREATE TABLE abc(a); |
︙ | ︙ | |||
116 117 118 119 120 121 122 | # Test IO errors that may occur during a multi-file commit. # # Tests 8 and 17 are excluded when auto-vacuum is enabled for the same # reason as in test cases ioerr-1.XXX set ex "" if {[string match [execsql {pragma auto_vacuum}] 1]} { | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | # Test IO errors that may occur during a multi-file commit. # # Tests 8 and 17 are excluded when auto-vacuum is enabled for the same # reason as in test cases ioerr-1.XXX set ex "" if {[string match [execsql {pragma auto_vacuum}] 1]} { set ex [list 4 17] } do_ioerr_test ioerr-5 -sqlprep { ATTACH 'test2.db' AS test2; } -sqlbody { BEGIN; CREATE TABLE t1(a,b,c); CREATE TABLE test2.t2(a,b,c); |
︙ | ︙ |
Changes to test/tester.tcl.
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 some common TCL routines used for regression # testing the SQLite library # | | | 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 some common TCL routines used for regression # testing the SQLite library # # $Id: tester.tcl,v 1.64 2006/01/24 13:09:33 danielk1977 Exp $ # Make sure tclsqlite3 was compiled correctly. Abort now with an # error message if not. # if {[sqlite3 -tcl-uses-utf]} { if {"\u1234"=="u1234"} { puts stderr "***** BUILD PROBLEM *****" |
︙ | ︙ | |||
378 379 380 381 382 383 384 385 | # Execute the TCL Script created in the above block. If # there are at least N IO operations performed by SQLite as # a result of the script, the Nth will fail. do_test $testname.$n.3 { set r [catch $::ioerrorbody msg] set ::go [expr {$::sqlite_io_error_pending<=0}] set s [expr $::sqlite_io_error_hit==0] # puts "$::sqlite_io_error_pending $r $msg" | > | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | # Execute the TCL Script created in the above block. If # there are at least N IO operations performed by SQLite as # a result of the script, the Nth will fail. do_test $testname.$n.3 { set r [catch $::ioerrorbody msg] set ::go [expr {$::sqlite_io_error_pending<=0}] set s [expr $::sqlite_io_error_hit==0] set ::sqlite_io_error_hit 0 # puts "$::sqlite_io_error_pending $r $msg" # puts "r=$r s=$s go=$::go msg=\"$msg\"" expr { ($s && !$r && !$::go) || (!$s && $r && $::go) } # expr {$::sqlite_io_error_pending>0 || $r!=0} } {1} # If an IO error occured, then the checksum of the database should # be the same as before the script that caused the IO error was run. if {$::go && $::ioerropts(-cksum)} { do_test $testname.$n.4 { |
︙ | ︙ |