Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Additional coverage testing in the new name resolver module. (CVS 5608) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0d61960afd35721d6d07acd75288c20d |
User & Date: | drh 2008-08-25 12:14:09.000 |
Context
2008-08-25
| ||
14:49 | Pick up a small performance increase by eliminating the pcacheRef() function. (CVS 5609) (check-in: e3840fbf0a user: danielk1977 tags: trunk) | |
12:14 | Additional coverage testing in the new name resolver module. (CVS 5608) (check-in: 0d61960afd user: drh tags: trunk) | |
12:08 | Two if statements should be asserts. GCC was silently ignoring them, hence the problem did not show up in coverage testing. Ticket #3333. (CVS 5607) (check-in: 635933b1ca user: drh tags: trunk) | |
Changes
Changes to src/resolve.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** ** This file contains routines used for walking the parser tree and ** resolve all identifiers by associating them with a particular ** table and column. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** ** This file contains routines used for walking the parser tree and ** resolve all identifiers by associating them with a particular ** table and column. ** ** $Id: resolve.c,v 1.3 2008/08/25 12:14:09 drh Exp $ */ #include "sqliteInt.h" #include <stdlib.h> #include <string.h> /* ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up |
︙ | ︙ | |||
89 90 91 92 93 94 95 | if( pSrcList ){ for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){ Table *pTab; int iDb; Column *pCol; pTab = pItem->pTab; | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | if( pSrcList ){ for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){ Table *pTab; int iDb; Column *pCol; pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); iDb = sqlite3SchemaToIndex(db, pTab->pSchema); assert( pTab->nCol>0 ); if( zTab ){ if( pItem->zAlias ){ char *zTabName = pItem->zAlias; if( sqlite3StrICmp(zTabName, zTab)!=0 ) continue; }else{ |
︙ | ︙ | |||
342 343 344 345 346 347 348 | ** function names. The operator for aggregate functions is changed ** to TK_AGG_FUNCTION. */ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ NameContext *pNC; Parse *pParse; | < | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | ** function names. The operator for aggregate functions is changed ** to TK_AGG_FUNCTION. */ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ NameContext *pNC; Parse *pParse; pNC = pWalker->u.pNC; assert( pNC!=0 ); pParse = pNC->pParse; assert( pParse==pWalker->pParse ); if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return WRC_Prune; ExprSetProperty(pExpr, EP_Resolved); |
︙ | ︙ |
Changes to test/collate8.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is making sure collations pass through the # unary + operator. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is making sure collations pass through the # unary + operator. # # $Id: collate8.test,v 1.2 2008/08/25 12:14:09 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test collate8-1.1 { execsql { CREATE TABLE t1(a TEXT COLLATE nocase); |
︙ | ︙ | |||
44 45 46 47 48 49 50 | } } {1 2} do_test collate8-1.5 { execsql { SELECT a FROM t1 ORDER BY +a } } {aaa BBB ccc DDD} | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 120 121 122 123 124 125 | } } {1 2} do_test collate8-1.5 { execsql { SELECT a FROM t1 ORDER BY +a } } {aaa BBB ccc DDD} do_test collate8-1.11 { execsql { SELECT a AS x FROM t1 ORDER BY "x"; } } {aaa BBB ccc DDD} do_test collate8-1.12 { execsql { SELECT a AS x FROM t1 WHERE x<'ccc' ORDER BY 1 } } {aaa BBB} do_test collate8-1.13 { execsql { SELECT a AS x FROM t1 WHERE x<'ccc' COLLATE binary ORDER BY [x] } } {aaa BBB DDD} do_test collate8-1.14 { execsql { SELECT a AS x FROM t1 WHERE +x<'ccc' ORDER BY 1 } } {aaa BBB} do_test collate8-1.15 { execsql { SELECT a AS x FROM t1 ORDER BY +x } } {aaa BBB ccc DDD} # When a result-set column is aliased into a WHERE clause, make sure the # collating sequence logic works correctly. # do_test collate8-2.1 { execsql { CREATE TABLE t2(a); INSERT INTO t2 VALUES('abc'); INSERT INTO t2 VALUES('ABC'); SELECT a AS x FROM t2 WHERE x='abc'; } } {abc} do_test collate8-2.2 { execsql { SELECT a AS x FROM t2 WHERE x='abc' COLLATE nocase; } } {abc ABC} do_test collate8-2.3 { execsql { SELECT a AS x FROM t2 WHERE (x COLLATE nocase)='abc'; } } {abc ABC} do_test collate8-2.4 { execsql { SELECT a COLLATE nocase AS x FROM t2 WHERE x='abc'; } } {abc ABC} do_test collate8-2.5 { execsql { SELECT a COLLATE nocase AS x FROM t2 WHERE (x COLLATE binary)='abc'; } } {abc} do_test collate8-2.6 { execsql { SELECT a COLLATE nocase AS x FROM t2 WHERE x='abc' COLLATE binary; } } {abc ABC} do_test collate8-2.7 { execsql { SELECT * FROM t2 WHERE (a COLLATE nocase)='abc' COLLATE binary; } } {abc ABC} do_test collate8-2.8 { execsql { SELECT a COLLATE nocase AS x FROM t2 WHERE 'abc'=x COLLATE binary; } } {abc} finish_test |
Changes to test/corrupt.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # | | < | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # # $Id: corrupt.test,v 1.10 2008/08/25 12:14:09 drh Exp $ catch {file delete -force test.db test.db-journal test.bu} set testdir [file dirname $argv0] source $testdir/tester.tcl # Construct a large database for testing. # do_test corrupt-1.1 { |
︙ | ︙ |
Changes to test/triggerB.test.
1 2 3 | # 2008 April 15 # # The author disclaims copyright to this source code. In place of | | | 1 2 3 4 5 6 7 8 9 10 11 | # 2008 April 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. Specifically, |
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 | } {1 1 0 2 1 0} do_test triggerB-1.2 { execsql { UPDATE vx SET y = yy; SELECT * FROM vx; } } {1 0 0 2 0 0} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | } {1 1 0 2 1 0} do_test triggerB-1.2 { execsql { UPDATE vx SET y = yy; SELECT * FROM vx; } } {1 0 0 2 0 0} # Added 2008-08-22: # # Name resolution within triggers. # do_test triggerB-2.1 { catchsql { CREATE TRIGGER ty AFTER INSERT ON x BEGIN SELECT wen.x; -- Unrecognized name END; INSERT INTO x VALUES(1,2); } } {1 {no such column: wen.x}} do_test triggerB-2.2 { catchsql { CREATE TRIGGER tz AFTER UPDATE ON x BEGIN SELECT dlo.x; -- Unrecognized name END; UPDATE x SET y=y+1; } } {1 {no such column: dlo.x}} do_test triggerB-2.3 { execsql { CREATE TABLE t2(a INTEGER PRIMARY KEY, b); INSERT INTO t2 VALUES(1,2); CREATE TABLE changes(x,y); CREATE TRIGGER r1t2 AFTER UPDATE ON t2 BEGIN INSERT INTO changes VALUES(new.a, new.b); END; } execsql { UPDATE t2 SET a=a+10; SELECT * FROM changes; } } {11 2} do_test triggerB-2.4 { execsql { CREATE TRIGGER r2t2 AFTER DELETE ON t2 BEGIN INSERT INTO changes VALUES(old.a, old.c); END; } catchsql { DELETE FROM t2; } } {1 {no such column: old.c}} # Triggers maintain a mask of columns from the invoking table that are # used in the trigger body as NEW.column or OLD.column. That mask is then # used to reduce the amount of information that needs to be loaded into # the NEW and OLD pseudo-tables at run-time. # # These tests cases check the logic for when there are many columns - more # than will fit in a bitmask. # do_test triggerB-3.1 { execsql { CREATE TABLE t3( c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c59, c60, c61, c62, c63, c64, c65 ); CREATE TABLE t3_changes(colnum, oldval, newval); INSERT INTO t3 VALUES( 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10','a11','a12','a13','a14','a15','a16','a17','a18','a19', 'a20','a21','a22','a23','a24','a25','a26','a27','a28','a29', 'a30','a31','a32','a33','a34','a35','a36','a37','a38','a39', 'a40','a41','a42','a43','a44','a45','a46','a47','a48','a49', 'a50','a51','a52','a53','a54','a55','a56','a57','a58','a59', 'a60','a61','a62','a63','a64','a65' ); } for {set i 0} {$i<=65} {incr i} { set sql [subst { CREATE TRIGGER t3c$i AFTER UPDATE ON t3 WHEN old.c$i!=new.c$i BEGIN INSERT INTO t3_changes VALUES($i, old.c$i, new.c$i); END }] db eval $sql } execsql { SELECT * FROM t3_changes } } {} for {set i 0} {$i<=64} {incr i} { do_test triggerB-3.2.$i.1 [subst { execsql { UPDATE t3 SET c$i='b$i'; SELECT * FROM t3_changes ORDER BY rowid DESC LIMIT 1; } }] [subst {$i a$i b$i}] do_test triggerB-3.2.$i.2 [subst { execsql { SELECT count(*) FROM t3_changes } }] [expr {$i+1}] do_test triggerB-3.2.$i.2 [subst { execsql { SELECT * FROM t3_changes WHERE colnum=$i } }] [subst {$i a$i b$i}] } finish_test |