aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest22
-rw-r--r--manifest.uuid2
-rw-r--r--src/prepare.c8
-rw-r--r--src/select.c30
-rw-r--r--src/test1.c70
-rw-r--r--src/where.c2
-rw-r--r--test/capi3.test8
-rw-r--r--test/mallocJ.test9
8 files changed, 80 insertions, 71 deletions
diff --git a/manifest b/manifest
index 3fe8a1f63..d336667d5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Increased\stest\scoverage.\s(CVS\s6147)
-D 2009-01-09T01:12:28
+C More\scoverage\simprovements.\s(CVS\s6148)
+D 2009-01-09T02:49:32
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 05461a9b5803d5ad10c79f989801e9fd2cc3e592
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -149,12 +149,12 @@ F src/pcache.c 16dc8da6e6ba6250f8dfd9ee46036db1cbceedc6
F src/pcache.h f20c3e82dd6da622c3fe296170cb1801f9a2d75a
F src/pcache1.c c0aa84ff69ea759fa944dbee9167a2463ab7c322
F src/pragma.c d6dfc47979623cf593d0db926daff49d214a8eb3
-F src/prepare.c 51d11eb1eece7548038e7e33c33ee95dc7f82e2d
+F src/prepare.c 2a11736383d0af2ea80aa62270f15ad80dd8b5cd
F src/printf.c 9866a9a9c4a90f6d4147407f373df3fd5d5f9b6f
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
F src/resolve.c 18dc9f0df1d60048e012ce6632251063e0dd356a
F src/rowset.c 570f9ebc189542f57cb0a2ecc3c47b00ac71d803
-F src/select.c af86044ede0e71b89062d48dc657578e2a5e1f99
+F src/select.c ae72b604e47092521c4d9ae54e1b1cbeb872a747
F src/shell.c 65d19f8996a160f288087e31810f24025439c62a
F src/sqlite.h.in 6cd2489e40fe97ba58c60044a4ced377e08b6d09
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
@@ -163,7 +163,7 @@ F src/sqliteLimit.h 651a2757ba55aeba1da167786b6a8c3404433940
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 23db1e5f27c03160987c122a078b4bb51ef0b2f8
F src/tclsqlite.c 4415e1033bd3e92b05a6a9cde911ee4de3b82df9
-F src/test1.c 058a52226e6c47e92b9df14654c5a1b41009e0fe
+F src/test1.c 473a6a230988f50129abe7614c95a9512f6efa78
F src/test2.c 724095fc69cb54b018aaa4463a56836c0b53a17a
F src/test3.c 88a246b56b824275300e6c899634fbac1dc94b14
F src/test4.c f79ab52d27ff49b784b631a42e2ccd52cfd5c84c
@@ -207,7 +207,7 @@ F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935
F src/vdbemem.c 19f94b504d3da44b31aef200fa6c8e07862de2e8
F src/vtab.c e39e011d7443a8d574b1b9cde207a35522e6df43
F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
-F src/where.c 86cd4009ae0b19d9223d526edfd6ed12dceeffc0
+F src/where.c 8259ee360fc260ee8144d7b4b3f21a573993ecf1
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
@@ -250,7 +250,7 @@ F test/boundary4.test 940bd509e34ae93c14ae62aeb8cf9afcf178b863
F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
F test/capi2.test 172c717ed101e78e0798dd21b9896a22366f35b4
-F test/capi3.test 4d9c110e8c78fdfe0ea61171a17609e627630ca6
+F test/capi3.test 168e2cd66c58c510955b0f299750e4de73b8d952
F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
F test/capi3c.test ce0fcbbaccfc9703fb247ea9ac5ada96dc9ca047
F test/capi3d.test 57d83b690d7364bde02cddbf8339a4b50d80ce23
@@ -448,7 +448,7 @@ F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
F test/mallocG.test 4584d0d8ddb8009f16ca0c8bab1fa37f6358efa2
F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb
F test/mallocI.test 6e24fe6444bd2999ccc81f984977b44c0d6e5591
-F test/mallocJ.test 44dfbbaca731cb933818ad300b4566265d652609
+F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e
F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
F test/malloc_common.tcl 984baeb6c6b185e798827d1187d426acc2bc4962
F test/manydb.test b3d3bc4c25657e7f68d157f031eb4db7b3df0d3c
@@ -696,7 +696,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 1e5725c5179660277c2e8c321877d7ee3ca21808
-R 822112d08067bd99c5e05699604f3ce2
+P 45bb5703d7ef5e835b43a6fa7ee2a2d96db76939
+R 9c598b92693d243d4089a75e467bcfdb
U drh
-Z d13ebeeb8ba28d13e8317f5ef4baf253
+Z 54fe2b39d55a9e6d88ce90f4b7ea9f31
diff --git a/manifest.uuid b/manifest.uuid
index 1fa18c4e5..280f52a26 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-45bb5703d7ef5e835b43a6fa7ee2a2d96db76939 \ No newline at end of file
+6e171c0a64850013b26a223189d5bebcc0a01a8b \ No newline at end of file
diff --git a/src/prepare.c b/src/prepare.c
index a6eaddb1f..38faaf78e 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
-** $Id: prepare.c,v 1.103 2008/12/10 19:26:24 drh Exp $
+** $Id: prepare.c,v 1.104 2009/01/09 02:49:32 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -501,18 +501,18 @@ int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
** function should never be used.
**
** We return -1000000 instead of the more usual -1 simply because using
- ** -1000000 as incorrectly using -1000000 index into db->aDb[] is much
+ ** -1000000 as the incorrect index into db->aDb[] is much
** more likely to cause a segfault than -1 (of course there are assert()
** statements too, but it never hurts to play the odds).
*/
assert( sqlite3_mutex_held(db->mutex) );
if( pSchema ){
- for(i=0; i<db->nDb; i++){
+ for(i=0; ALWAYS(i<db->nDb); i++){
if( db->aDb[i].pSchema==pSchema ){
break;
}
}
- assert( i>=0 &&i>=0 && i<db->nDb );
+ assert( i>=0 && i<db->nDb );
}
return i;
}
diff --git a/src/select.c b/src/select.c
index 1feb6ae56..432e55083 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.497 2009/01/09 01:12:28 drh Exp $
+** $Id: select.c,v 1.498 2009/01/09 02:49:32 drh Exp $
*/
#include "sqliteInt.h"
@@ -342,7 +342,7 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
Table *pRightTab = pRight->pTab;
int isOuter;
- if( pLeftTab==0 || pRightTab==0 ) continue;
+ if( NEVER(pLeftTab==0 || pRightTab==0) ) continue;
isOuter = (pRight->jointype & JT_OUTER)!=0;
/* When the NATURAL keyword is present, add WHERE clause terms for
@@ -542,7 +542,8 @@ static void selectInnerLoop(
int iParm = pDest->iParm; /* First argument to disposal method */
int nResultCol; /* Number of result columns */
- if( v==0 ) return;
+ assert( v );
+ if( NEVER(v==0) ) return;
assert( pEList!=0 );
hasDistinct = distinct>=0;
if( pOrderBy==0 && !hasDistinct ){
@@ -560,11 +561,8 @@ static void selectInnerLoop(
pDest->iMem = pParse->nMem+1;
pDest->nMem = nResultCol;
pParse->nMem += nResultCol;
- }else if( pDest->nMem!=nResultCol ){
- /* This happens when two SELECTs of a compound SELECT have differing
- ** numbers of result columns. The error message will be generated by
- ** a higher-level routine. */
- return;
+ }else{
+ assert( pDest->nMem==nResultCol );
}
regResult = pDest->iMem;
if( nColumn>0 ){
@@ -813,6 +811,8 @@ static void generateSortTail(
switch( eDest ){
case SRT_Table:
case SRT_EphemTab: {
+ testcase( eDest==SRT_Table );
+ testcase( eDest==SRT_EphemTab );
sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);
sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
@@ -836,6 +836,8 @@ static void generateSortTail(
case SRT_Output:
case SRT_Coroutine: {
int i;
+ testcase( eDest==SRT_Output );
+ testcase( eDest==SRT_Coroutine );
sqlite3VdbeAddOp2(v, OP_Integer, 1, regRowid);
sqlite3VdbeAddOp3(v, OP_Insert, pseudoTab, regRow, regRowid);
for(i=0; i<nColumn; i++){
@@ -946,7 +948,7 @@ static const char *columnType(
** of the SELECT statement. Return the declaration type and origin
** data for the result-set column of the sub-select.
*/
- if( iCol>=0 && iCol<pS->pEList->nExpr ){
+ if( ALWAYS(iCol>=0 && iCol<pS->pEList->nExpr) ){
/* If iCol is less than zero, then the expression requests the
** rowid of the sub-select or view. This expression is legal (see
** test case misc2.2.2) - it always evaluates to NULL.
@@ -958,7 +960,7 @@ static const char *columnType(
sNC.pParse = pNC->pParse;
zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol);
}
- }else if( pTab->pSchema ){
+ }else if( ALWAYS(pTab->pSchema) ){
/* A real table */
assert( !pS );
if( iCol<0 ) iCol = pTab->iPKey;
@@ -1098,13 +1100,9 @@ static void generateColumnNames(
if( !shortNames && !fullNames ){
sqlite3VdbeSetColName(v, i, COLNAME_NAME,
sqlite3DbStrNDup(db, (char*)p->span.z, p->span.n), SQLITE_DYNAMIC);
- }else if( fullNames || (!shortNames && pTabList->nSrc>1) ){
+ }else if( fullNames ){
char *zName = 0;
- char *zTab;
-
- zTab = pTabList->a[j].zAlias;
- if( fullNames || zTab==0 ) zTab = pTab->zName;
- zName = sqlite3MPrintf(db, "%s.%s", zTab, zCol);
+ zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
}else{
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);
diff --git a/src/test1.c b/src/test1.c
index 3dfc715af..f5ba0cb0c 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.339 2009/01/07 18:24:03 drh Exp $
+** $Id: test1.c,v 1.340 2009/01/09 02:49:32 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -3245,7 +3245,7 @@ static int test_errmsg16(
}
/*
-** Usage: sqlite3_prepare DB sql bytes tailvar
+** Usage: sqlite3_prepare DB sql bytes ?tailvar?
**
** Compile up to <bytes> bytes of the supplied SQL string <sql> using
** database handle <DB>. The parameter <tailval> is the name of a global
@@ -3266,18 +3266,18 @@ static int test_prepare(
char zBuf[50];
int rc;
- if( objc!=5 ){
+ if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes tailvar", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
zSql = Tcl_GetString(objv[2]);
if( Tcl_GetIntFromObj(interp, objv[3], &bytes) ) return TCL_ERROR;
- rc = sqlite3_prepare(db, zSql, bytes, &pStmt, &zTail);
+ rc = sqlite3_prepare(db, zSql, bytes, &pStmt, objc>=5 ? &zTail : 0);
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
- if( zTail ){
+ if( zTail && objc>=5 ){
if( bytes>=0 ){
bytes = bytes - (zTail-zSql);
}
@@ -3301,7 +3301,7 @@ static int test_prepare(
}
/*
-** Usage: sqlite3_prepare_v2 DB sql bytes tailvar
+** Usage: sqlite3_prepare_v2 DB sql bytes ?tailvar?
**
** Compile up to <bytes> bytes of the supplied SQL string <sql> using
** database handle <DB>. The parameter <tailval> is the name of a global
@@ -3322,7 +3322,7 @@ static int test_prepare_v2(
char zBuf[50];
int rc;
- if( objc!=5 ){
+ if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tcl_GetString(objv[0]), " DB sql bytes tailvar", 0);
return TCL_ERROR;
@@ -3331,10 +3331,10 @@ static int test_prepare_v2(
zSql = Tcl_GetString(objv[2]);
if( Tcl_GetIntFromObj(interp, objv[3], &bytes) ) return TCL_ERROR;
- rc = sqlite3_prepare_v2(db, zSql, bytes, &pStmt, &zTail);
+ rc = sqlite3_prepare_v2(db, zSql, bytes, &pStmt, objc>=5 ? &zTail : 0);
assert(rc==SQLITE_OK || pStmt==0);
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
- if( zTail ){
+ if( zTail && objc>=5 ){
if( bytes>=0 ){
bytes = bytes - (zTail-zSql);
}
@@ -3420,30 +3420,32 @@ static int test_prepare16(
int bytes; /* The integer specified as arg 3 */
int objlen; /* The byte-array length of arg 2 */
- if( objc!=5 ){
+ if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes tailvar", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
zSql = Tcl_GetByteArrayFromObj(objv[2], &objlen);
if( Tcl_GetIntFromObj(interp, objv[3], &bytes) ) return TCL_ERROR;
- rc = sqlite3_prepare16(db, zSql, bytes, &pStmt, &zTail);
+ rc = sqlite3_prepare16(db, zSql, bytes, &pStmt, objc>=5 ? &zTail : 0);
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
if( rc ){
return TCL_ERROR;
}
- if( zTail ){
- objlen = objlen - ((u8 *)zTail-(u8 *)zSql);
- }else{
- objlen = 0;
+ if( objc>=5 ){
+ if( zTail ){
+ objlen = objlen - ((u8 *)zTail-(u8 *)zSql);
+ }else{
+ objlen = 0;
+ }
+ pTail = Tcl_NewByteArrayObj((u8 *)zTail, objlen);
+ Tcl_IncrRefCount(pTail);
+ Tcl_ObjSetVar2(interp, objv[4], 0, pTail, 0);
+ Tcl_DecrRefCount(pTail);
}
- pTail = Tcl_NewByteArrayObj((u8 *)zTail, objlen);
- Tcl_IncrRefCount(pTail);
- Tcl_ObjSetVar2(interp, objv[4], 0, pTail, 0);
- Tcl_DecrRefCount(pTail);
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
@@ -3454,7 +3456,7 @@ static int test_prepare16(
}
/*
-** Usage: sqlite3_prepare16_v2 DB sql bytes tailvar
+** Usage: sqlite3_prepare16_v2 DB sql bytes ?tailvar?
**
** Compile up to <bytes> bytes of the supplied SQL string <sql> using
** database handle <DB>. The parameter <tailval> is the name of a global
@@ -3478,30 +3480,32 @@ static int test_prepare16_v2(
int bytes; /* The integer specified as arg 3 */
int objlen; /* The byte-array length of arg 2 */
- if( objc!=5 ){
+ if( objc!=5 && objc!=4 ){
Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " DB sql bytes tailvar", 0);
+ Tcl_GetString(objv[0]), " DB sql bytes ?tailvar?", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
zSql = Tcl_GetByteArrayFromObj(objv[2], &objlen);
if( Tcl_GetIntFromObj(interp, objv[3], &bytes) ) return TCL_ERROR;
- rc = sqlite3_prepare16_v2(db, zSql, bytes, &pStmt, &zTail);
+ rc = sqlite3_prepare16_v2(db, zSql, bytes, &pStmt, objc>=5 ? &zTail : 0);
if( sqlite3TestErrCode(interp, db, rc) ) return TCL_ERROR;
if( rc ){
return TCL_ERROR;
}
- if( zTail ){
- objlen = objlen - ((u8 *)zTail-(u8 *)zSql);
- }else{
- objlen = 0;
+ if( objc>=5 ){
+ if( zTail ){
+ objlen = objlen - ((u8 *)zTail-(u8 *)zSql);
+ }else{
+ objlen = 0;
+ }
+ pTail = Tcl_NewByteArrayObj((u8 *)zTail, objlen);
+ Tcl_IncrRefCount(pTail);
+ Tcl_ObjSetVar2(interp, objv[4], 0, pTail, 0);
+ Tcl_DecrRefCount(pTail);
}
- pTail = Tcl_NewByteArrayObj((u8 *)zTail, objlen);
- Tcl_IncrRefCount(pTail);
- Tcl_ObjSetVar2(interp, objv[4], 0, pTail, 0);
- Tcl_DecrRefCount(pTail);
if( pStmt ){
if( sqlite3TestMakePointerStr(interp, zBuf, pStmt) ) return TCL_ERROR;
diff --git a/src/where.c b/src/where.c
index 5c6ae3100..2d773b78d 100644
--- a/src/where.c
+++ b/src/where.c
@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
-** $Id: where.c,v 1.361 2009/01/08 21:00:03 drh Exp $
+** $Id: where.c,v 1.362 2009/01/09 02:49:32 drh Exp $
*/
#include "sqliteInt.h"
diff --git a/test/capi3.test b/test/capi3.test
index 86056485e..0111dba4f 100644
--- a/test/capi3.test
+++ b/test/capi3.test
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
-# $Id: capi3.test,v 1.69 2008/11/05 16:37:35 drh Exp $
+# $Id: capi3.test,v 1.70 2009/01/09 02:49:32 drh Exp $
#
set testdir [file dirname $argv0]
@@ -121,7 +121,7 @@ ifcapable {utf16} {
do_test capi3-2.3 {
set sql [utf16 {SELECT namex FROM sqlite_master}]
catch {
- set STMT [sqlite3_prepare16 $DB $sql -1 TAIL]
+ set STMT [sqlite3_prepare16 $DB $sql -1]
}
} {1}
do_test capi3-2.4.1 {
@@ -137,8 +137,8 @@ ifcapable {utf16} {
ifcapable schema_pragmas {
do_test capi3-2.6 {
execsql {CREATE TABLE tablename(x)}
- set sql16 [utf16 {PRAGMA table_info("TableName")}]
- set STMT [sqlite3_prepare16 $DB $sql16 -1 TAIL]
+ set sql16 [utf16 {PRAGMA table_info("TableName"); --excess text}]
+ set STMT [sqlite3_prepare16 $DB $sql16 -1]
sqlite3_step $STMT
} SQLITE_ROW
do_test capi3-2.7 {
diff --git a/test/mallocJ.test b/test/mallocJ.test
index eb77d54bd..e63f6b794 100644
--- a/test/mallocJ.test
+++ b/test/mallocJ.test
@@ -12,7 +12,7 @@
# This test script checks malloc failures in LIMIT operations for
# UPDATE/DELETE statements.
#
-# $Id: mallocJ.test,v 1.5 2008/11/11 18:29:00 drh Exp $
+# $Id: mallocJ.test,v 1.6 2009/01/09 02:49:32 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -63,4 +63,11 @@ do_malloc_test mallocJ-4 -sqlprep {
SELECT * FROM (SELECT a,b FROM t1 UNION ALL SELECT x, y FROM t2) ORDER BY 1
}
+# coverage testing
+do_malloc_test mallocJ-5 -sqlprep {
+ CREATE TABLE t1(["a"]);
+} -sqlbody {
+ SELECT * FROM t1
+}
+
finish_test