Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove an unreachable case from xferOptimization(). Also other minor test coverage improvements. (CVS 4383) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
75af7189c0ed1b24a32cff6960af7f17 |
User & Date: | danielk1977 2007-09-03 17:30:07.000 |
Context
2007-09-03
| ||
17:42 | Unix OS interface returns SQLITE_CANTOPEN following a getcwd() failure. (CVS 4384) (check-in: ed15db4610 user: drh tags: trunk) | |
17:30 | Remove an unreachable case from xferOptimization(). Also other minor test coverage improvements. (CVS 4383) (check-in: 75af7189c0 user: danielk1977 tags: trunk) | |
17:09 | Fix the open file counter on windows. (CVS 4382) (check-in: 40cf0c1776 user: drh tags: trunk) | |
Changes
Changes to src/insert.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 file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** | | | 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 file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** ** $Id: insert.c,v 1.192 2007/09/03 17:30:07 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** Set P3 of the most recently inserted opcode to a column affinity ** string for index pIdx. A column affinity string has one character ** for each column in the table, according to the affinity of the column: |
︙ | ︙ | |||
1414 1415 1416 1417 1418 1419 1420 | #endif if( onError==OE_Default ){ onError = OE_Abort; } if( onError!=OE_Abort && onError!=OE_Rollback ){ return 0; /* Cannot do OR REPLACE or OR IGNORE or OR FAIL */ } | | < < | 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | #endif if( onError==OE_Default ){ onError = OE_Abort; } if( onError!=OE_Abort && onError!=OE_Rollback ){ return 0; /* Cannot do OR REPLACE or OR IGNORE or OR FAIL */ } assert(pSelect->pSrc); /* allocated even if there is no FROM clause */ if( pSelect->pSrc->nSrc!=1 ){ return 0; /* FROM clause must have exactly one term */ } if( pSelect->pSrc->a[0].pSelect ){ return 0; /* FROM clause cannot contain a subquery */ } if( pSelect->pWhere ){ |
︙ | ︙ |
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 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. ** ************************************************************************* ** Code for testing all sorts of SQLite interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.277 2007/09/03 17:30:07 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> /* |
︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break; case SQLITE_AUTH: zName = "SQLITE_AUTH"; break; case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break; case SQLITE_RANGE: zName = "SQLITE_RANGE"; break; case SQLITE_ROW: zName = "SQLITE_ROW"; break; case SQLITE_DONE: zName = "SQLITE_DONE"; break; case SQLITE_NOTADB: zName = "SQLITE_NOTADB"; break; default: zName = "SQLITE_Unknown"; break; } return zName; } #define t1ErrorName sqlite3TestErrorName /* | > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break; case SQLITE_AUTH: zName = "SQLITE_AUTH"; break; case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break; case SQLITE_RANGE: zName = "SQLITE_RANGE"; break; case SQLITE_ROW: zName = "SQLITE_ROW"; break; case SQLITE_DONE: zName = "SQLITE_DONE"; break; case SQLITE_NOTADB: zName = "SQLITE_NOTADB"; break; case SQLITE_TOOBIG: zName = "SQLITE_TOOBIG"; break; default: zName = "SQLITE_Unknown"; break; } return zName; } #define t1ErrorName sqlite3TestErrorName /* |
︙ | ︙ |
Changes to test/insert4.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2007 January 24 # # 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 file is testing the INSERT transfer optimization. # | | > | 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 | # 2007 January 24 # # 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 file is testing the INSERT transfer optimization. # # $Id: insert4.test,v 1.6 2007/09/03 17:30:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # The sqlite3_xferopt_count variable is incremented whenever the # insert transfer optimization applies. # # This procedure runs a test to see if the sqlite3_xferopt_count is # set to N. # proc xferopt_test {testname N} { do_test $testname {set ::sqlite3_xferopt_count} $N } # Create tables used for testing. # execsql { PRAGMA legacy_file_format = 0; CREATE TABLE t1(a int, b int, check(b>a)); CREATE TABLE t2(x int, y int); CREATE VIEW v2 AS SELECT y, x FROM t2; CREATE TABLE t3(a int, b int); } # Ticket #2252. Make sure the an INSERT from identical tables |
︙ | ︙ | |||
222 223 224 225 226 227 228 | # "int" and "integer" are equivalent so the optimization should # run here. # xfer_check insert4-3.22 1 {1 9} \ {a int, b int} \ {x integer, b int} | < > > > > > > > > > > > > > > > > > > > > > > > > > | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | # "int" and "integer" are equivalent so the optimization should # run here. # xfer_check insert4-3.22 1 {1 9} \ {a int, b int} \ {x integer, b int} # Ticket #2291. # do_test insert4-4.1 { execsql { CREATE TABLE t4(a, b, UNIQUE(a,b)); INSERT INTO t4 VALUES(NULL,0); INSERT INTO t4 VALUES(NULL,1); INSERT INTO t4 VALUES(NULL,1); VACUUM; } } {} # Check some error conditions: # do_test insert4-5.1 { # Table does not exist. catchsql { INSERT INTO t2 SELECT * FROM nosuchtable } } {1 {no such table: nosuchtable}} do_test insert4-5.2 { # Number of columns does not match. catchsql { CREATE TABLE t5(a, b, c); INSERT INTO t4 SELECT * FROM t5; } } {1 {table t4 has 2 columns but 3 values were supplied}} do_test insert4-6.1 { execsql { CREATE INDEX t2_i2 ON t2(x, y COLLATE nocase); CREATE INDEX t2_i1 ON t2(x ASC, y DESC); CREATE INDEX t3_i1 ON t3(a, b); INSERT INTO t2 SELECT * FROM t3; } } {} finish_test |
Changes to test/sqllimits1.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # | | | 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 contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # # $Id: sqllimits1.test,v 1.16 2007/09/03 17:30:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # sqllimits-1.*: SQLITE_MAX_LENGTH |
︙ | ︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | catchsql { SELECT quote($::str1) } } {1 {string or blob too big}} do_test sqllimits-1.13 { set ::str1 [string repeat ' [expr {$SQLITE_MAX_LENGTH - 10}]] catchsql { SELECT hex($::str1) } } {1 {string or blob too big}} #-------------------------------------------------------------------- # Test cases sqllimits-2.* test that the SQLITE_MAX_SQL_LENGTH limit # is enforced. # do_test sqllimits-2.1 { set sql "SELECT 1 WHERE 1==1" | > > > > > > > > > > > | 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 | catchsql { SELECT quote($::str1) } } {1 {string or blob too big}} do_test sqllimits-1.13 { set ::str1 [string repeat ' [expr {$SQLITE_MAX_LENGTH - 10}]] catchsql { SELECT hex($::str1) } } {1 {string or blob too big}} do_test sqllimits-1.14.1 { set ::STMT [sqlite3_prepare $::DB "SELECT ?" -1 TAIL] sqlite3_bind_zeroblob $::STMT 1 [expr {$SQLITE_MAX_LENGTH + 1}] } {} do_test sqllimits-1.14.2 { sqlite3_step $::STMT } {SQLITE_ERROR} do_test sqllimits-1.14.3 { sqlite3_finalize $::STMT } {SQLITE_TOOBIG} #-------------------------------------------------------------------- # Test cases sqllimits-2.* test that the SQLITE_MAX_SQL_LENGTH limit # is enforced. # do_test sqllimits-2.1 { set sql "SELECT 1 WHERE 1==1" |
︙ | ︙ |