diff --git a/manifest b/manifest index aa1ca54669..7c19a7e52d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Exclude\sa\sfew\smore\slines\sof\scode\susing\sOMIT\smacros.\s(CVS\s2253) -D 2005-01-21T08:13:14 +C Improve\stest\scoverage\sfor\sminimum\sfeature\sbuilds.\s(CVS\s2254) +D 2005-01-21T11:55:26 F Makefile.in ffd81f5e926d40b457071b4de8d7c1fa18f39b5a F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -29,9 +29,9 @@ F sqlite3.def dbaeb20c153e1d366e8f421b55a573f5dfc00863 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a F src/attach.c cecf5ab42cff34416372a0210b14abb50ed48ef9 F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea -F src/btree.c 812ee6b8eed884801a40b71f674cddf56a5e0888 +F src/btree.c e68ae12c8b12ef9d45d58d931c36c184055a3880 F src/btree.h 74d19cf40ab49fd69abe9e4e12a6c321ad86c497 -F src/build.c 9c9e9dbb9d8619f0755be79fcb30df5a8347a8ed +F src/build.c b60b1f1f48521fe5b4bf98a189cadc205b2e8065 F src/cursor.c de73c00aefc4747ad59b5105cf38bbff0667922e F src/date.c f3d1f5cd1503dabf426a198f3ebef5afbc122a7f F src/delete.c b3accca9c38d9a67dbd724f67b04151a13735ebd @@ -64,7 +64,7 @@ F src/sqlite.h.in 8249b697d71ef6d7f7f752ba4ca04058e9e8b5ff F src/sqliteInt.h 01ea63415bb96ad8ab6e26bede2aa6a39cefb082 F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 F src/tclsqlite.c fd27457b228118be96524dae285146c76efe032b -F src/test1.c c4f2a1d6ad8f14a1168a4c933ce5c5cb2d243d86 +F src/test1.c 35c055c934ea9797d1b8ca7083ced6a9b263f2ec F src/test2.c bbc2ecc58ceeab12d1e40970f831b1017524e40d F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0 F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df @@ -85,11 +85,11 @@ F src/where.c f4127cc2633ee0f74790ab7f09f5af832489e44e F tclinstaller.tcl 36478c3bbfc5b93ceac42d94e3c736937b808432 F test/all.test 7f0988442ab811dfa41793b5b550f5828ce316f3 F test/alter.test 95c57a4f461fa81293e0dccef7f83889aadb169a -F test/attach.test 660ed5ed29e864fc6c1710845e939df79467ed34 +F test/attach.test 3391776495dc9434c8f3c67a7591db2aef0cd4fa F test/attach2.test eeb987770f4dbe68bd29afdbc2e8cff0142e6eb5 F test/attach3.test c05c70b933afbde0901dab9da3e66ee842c09f38 F test/auth.test 559e0816b8100740624ebb0ab7aab05f5c92831c -F test/autoinc.test c071e51ff167b8e889212273588d9cca71845b70 +F test/autoinc.test c6daf10ffce8a898cd375b4a71615a741a6029d0 F test/autovacuum.test a87871f29761093dc171e97c9d0dd5ae7d43b0d1 F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31 F test/autovacuum_ioerr.test 9cf27275ca47b72e188a47c53b61b6d583a01d24 @@ -126,9 +126,9 @@ F test/diskfull.test e2f6cfd868713ead06dc82b84a4938e868128fc0 F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52 F test/enc2.test e5e95be36676df5ba7c4c4c837cabcdf9fe01f5b F test/enc3.test f6a5f0b7b7f3a88f030d3143729b87cd5c86d837 -F test/expr.test b2ce68f4b3298dd06867468b770ca2604068014e +F test/expr.test 54d9d1cc05eb731fa62daa70f2d7163f8a03c54d F test/fkey1.test 81bb13caaa78f58d7d191d7f535529f7c91d821a -F test/func.test 47443316dfc7f78f173b207e35d63caeab42b7fe +F test/func.test 9a467351e2a50c8846623ac7451d3bc2516b6e6d F test/hook.test f8605cde4c77b2c6a4a73723bf6c507796a64dda F test/in.test ed134f8d477a6280297ced1646de83cccf8f196d F test/index.test 51e01a0928b4b61228917ddd8c6c0e2466547f6f @@ -182,7 +182,7 @@ F test/select5.test 94db800bbeff2e426c0175e07f7a71d4617853b5 F test/select6.test ba1b4dd18a85bf9070c6df8d933ac4cfcacea6a6 F test/select7.test 63fb77d50f4dfdac4d4115842f083d2eb33a198c F test/sort.test 87882e6c72a75d45e98a1c802c1ded0eac557d85 -F test/subquery.test 34ee5ea73751f880e4d9af9149bd9e14156347ae +F test/subquery.test a3ed9f11a4e576ff31b539ab5d65953dc3d27a81 F test/subselect.test 3f3f7a940dc3195c3139f4d530385cb54665d614 F test/table.test a6b6b897731b4971f06db165d65bd608a9f2d461 F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1 @@ -271,7 +271,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl 3e522a06ad41992023c80ca29a048ae2331ca5bd -P d4e19efcef68d834c55c7d496cdb3696d63a31a2 -R f22d940e12f93d2a72377ccf52f1ee48 +P c6fc49e61033419e78b6b10638d57f4942087961 +R 72b61915b4b55438a51d57f3746cef1c U danielk1977 -Z ac1cb2768224dd061522306186c6fe8f +Z 90e04e1ec937afd20abd081dbd664846 diff --git a/manifest.uuid b/manifest.uuid index 9d4663d2df..ea3f0ff746 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c6fc49e61033419e78b6b10638d57f4942087961 \ No newline at end of file +9c4d0e13e8c5f3fc4d7fd8f495898372293f7fad \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 8eb474c7cf..e768a8fae1 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.243 2005/01/21 08:13:14 danielk1977 Exp $ +** $Id: btree.c,v 1.244 2005/01/21 11:55:26 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -1331,6 +1331,7 @@ int sqlite3BtreeSetSafetyLevel(Btree *pBt, int level){ } #endif +#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) /* ** Change the default pages size and the number of reserved bytes per page. ** @@ -1372,6 +1373,7 @@ int sqlite3BtreeGetPageSize(Btree *pBt){ int sqlite3BtreeGetReserve(Btree *pBt){ return pBt->pageSize - pBt->usableSize; } +#endif /* !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) */ /* ** Change the 'auto-vacuum' property of the database. If the 'autoVacuum' diff --git a/src/build.c b/src/build.c index 603ecd755e..8b238ceb6b 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.296 2005/01/21 00:44:22 danielk1977 Exp $ +** $Id: build.c,v 1.297 2005/01/21 11:55:27 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -427,6 +427,7 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ sqliteDeleteIndex(db, pIndex); } +#ifndef SQLITE_OMIT_FOREIGN_KEY /* Delete all foreign keys associated with this table. The keys ** should have already been unlinked from the db->aFKey hash table */ @@ -437,6 +438,7 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ pFKey->zTo, strlen(pFKey->zTo)+1)!=pFKey ); sqliteFree(pFKey); } +#endif /* Delete the Table structure itself. */ @@ -462,6 +464,7 @@ void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){ pDb = &db->aDb[iDb]; p = sqlite3HashInsert(&pDb->tblHash, zTabName, strlen(zTabName)+1, 0); if( p ){ +#ifndef SQLITE_OMIT_FOREIGN_KEY for(pF1=p->pFKey; pF1; pF1=pF1->pNextFrom){ int nTo = strlen(pF1->zTo) + 1; pF2 = sqlite3HashFind(&pDb->aFKey, pF1->zTo, nTo); @@ -474,6 +477,7 @@ void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){ } } } +#endif sqlite3DeleteTable(db, p); } db->flags |= SQLITE_InternChanges; @@ -517,7 +521,7 @@ void sqlite3OpenMasterTable(Vdbe *v, int iDb){ ** does not exist. */ static int findDb(sqlite3 *db, Token *pName){ - int i; /* Database number */ + int i = -1; /* Database number */ int n; /* Number of characters in the name */ Db *pDb; /* A database whose name space is being searched */ char *zName; /* Name we are searching for */ @@ -525,15 +529,14 @@ static int findDb(sqlite3 *db, Token *pName){ zName = sqlite3NameFromToken(pName); if( zName ){ n = strlen(zName); - for(pDb=db->aDb, i=0; inDb; i++, pDb++){ + for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){ if( n==strlen(pDb->zName) && 0==sqlite3StrICmp(pDb->zName, zName) ){ - sqliteFree(zName); - return i; + break; } } sqliteFree(zName); } - return -1; + return i; } /* The table or view or trigger name is passed to this routine via tokens @@ -1061,6 +1064,7 @@ static void callCollNeeded(sqlite3 *db, const char *zName, int nName){ db->xCollNeeded(db->pCollNeededArg, db, (int)db->enc, zExternal); sqliteFree(zExternal); } +#ifndef SQLITE_OMIT_UTF16 if( db->xCollNeeded16 ){ char const *zExternal; sqlite3_value *pTmp = sqlite3GetTransientValue(db); @@ -1069,6 +1073,7 @@ static void callCollNeeded(sqlite3 *db, const char *zName, int nName){ if( !zExternal ) return; db->xCollNeeded16(db->pCollNeededArg, db, (int)db->enc, zExternal); } +#endif } /* @@ -1402,11 +1407,13 @@ void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){ sqlite3VdbeAddOp(v, OP_CreateTable, p->iDb, 0); zType = "table"; zType2 = "TABLE"; +#ifndef SQLITE_OMIT_VIEW }else{ /* A view */ sqlite3VdbeAddOp(v, OP_Integer, 0, 0); zType = "view"; zType2 = "VIEW"; +#endif } /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT @@ -1496,11 +1503,13 @@ void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){ assert( p==pOld ); /* Malloc must have failed inside HashInsert() */ return; } +#ifndef SQLITE_OMIT_FOREIGN_KEY for(pFKey=p->pFKey; pFKey; pFKey=pFKey->pNextFrom){ int nTo = strlen(pFKey->zTo) + 1; pFKey->pNextTo = sqlite3HashFind(&pDb->aFKey, pFKey->zTo, nTo); sqlite3HashInsert(&pDb->aFKey, pFKey->zTo, nTo, pFKey); } +#endif pParse->pNewTable = 0; db->nTable++; db->flags |= SQLITE_InternChanges; @@ -1811,6 +1820,11 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView){ sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); goto exit_drop_table; } + +#ifndef SQLITE_OMIT_VIEW + /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used + ** on a table. + */ if( isView && pTab->pSelect==0 ){ sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName); goto exit_drop_table; @@ -1819,6 +1833,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView){ sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName); goto exit_drop_table; } +#endif /* Generate code to remove the table from the master table ** on disk. @@ -2144,10 +2159,12 @@ void sqlite3CreateIndex( sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName); goto exit_create_index; } +#ifndef SQLITE_OMIT_VIEW if( pTab->pSelect ){ sqlite3ErrorMsg(pParse, "views may not be indexed"); goto exit_create_index; } +#endif isTemp = pTab->iDb==1; /* @@ -2806,6 +2823,7 @@ void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ } } +#ifndef SQLITE_OMIT_UTF16 /* ** Return the transient sqlite3_value object used for encoding conversions ** during SQL compilation. @@ -2816,6 +2834,7 @@ sqlite3_value *sqlite3GetTransientValue(sqlite3 *db){ } return db->pValue; } +#endif /* ** Check to see if pIndex uses the collating sequence pColl. Return diff --git a/src/test1.c b/src/test1.c index 3e917d0ca8..0601e89b83 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.125 2005/01/21 03:12:16 danielk1977 Exp $ +** $Id: test1.c,v 1.126 2005/01/21 11:55:27 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -478,7 +478,6 @@ static int test_create_function( ){ int rc; sqlite3 *db; - sqlite3_value *pVal; extern void Md5_Register(sqlite3*); if( argc!=2 ){ @@ -494,6 +493,7 @@ static int test_create_function( /* Use the sqlite3_create_function16() API here. Mainly for fun, but also ** because it is not tested anywhere else. */ if( rc==SQLITE_OK ){ + sqlite3_value *pVal; pVal = sqlite3ValueNew(); sqlite3ValueSetStr(pVal, -1, "x_sqlite_exec", SQLITE_UTF8, SQLITE_STATIC); rc = sqlite3_create_function16(db, diff --git a/test/attach.test b/test/attach.test index ed5525ebd6..504c58b375 100644 --- a/test/attach.test +++ b/test/attach.test @@ -12,7 +12,7 @@ # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # -# $Id: attach.test,v 1.33 2005/01/21 04:25:47 danielk1977 Exp $ +# $Id: attach.test,v 1.34 2005/01/21 11:55:27 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -680,6 +680,19 @@ if {$tcl_platform(platform)=="unix"} { file delete -force cannot-read } +# Check the error message if we try to access a database that has +# not been attached. +do_test attach-6.3 { + catchsql { + CREATE TABLE no_such_db.t1(a, b, c); + } +} {1 {unknown database no_such_db}} +do_test attach-6.4 { + catchsql { + CREATE TEMP TABLE db2.temp1(a, b, c); + } +} {1 {temporary table name must be unqualified}} + for {set i 2} {$i<=15} {incr i} { catch {db$i close} } diff --git a/test/autoinc.test b/test/autoinc.test index bd330233f2..82e05f16f3 100644 --- a/test/autoinc.test +++ b/test/autoinc.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the AUTOINCREMENT features. # -# $Id: autoinc.test,v 1.2 2004/11/22 13:35:42 danielk1977 Exp $ +# $Id: autoinc.test,v 1.3 2005/01/21 11:55:27 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -476,5 +476,13 @@ do_test autoinc-7.1 { } } {3 345} +# Test that if the AUTOINCREMENT is applied to a non integer primary key +# the error message is sensible. +do_test autoinc-7.2 { + catchsql { + CREATE TABLE t8(x TEXT PRIMARY KEY AUTOINCREMENT); + } +} {1 {AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY}} + catch {db2 close} finish_test diff --git a/test/expr.test b/test/expr.test index 39f1d38fec..c23b5687d3 100644 --- a/test/expr.test +++ b/test/expr.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing expressions. # -# $Id: expr.test,v 1.42 2005/01/21 03:12:16 danielk1977 Exp $ +# $Id: expr.test,v 1.43 2005/01/21 11:55:27 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -553,4 +553,12 @@ do_test expr-9.1 { execsql {SELECT round(-('-'||'123'))} } 123 +# Test an error message that can be generated by the LIKE expression +do_test expr-10.1 { + catchsql {SELECT 'abc' LIKE 'abc' ESCAPE ''} +} {1 {ESCAPE expression must be a single character}} +do_test expr-10.2 { + catchsql {SELECT 'abc' LIKE 'abc' ESCAPE 'ab'} +} {1 {ESCAPE expression must be a single character}} + finish_test diff --git a/test/func.test b/test/func.test index 2ffa8bacd5..dd58668c11 100644 --- a/test/func.test +++ b/test/func.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing built-in functions. # -# $Id: func.test,v 1.32 2005/01/20 02:17:02 danielk1977 Exp $ +# $Id: func.test,v 1.33 2005/01/21 11:55:28 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -461,4 +461,19 @@ do_test func-15.1 { } } {1 {user function error}} +# Test the quote function for BLOB and NULL values. +do_test func-16.1 { + execsql { + CREATE TABLE tbl2(a, b); + } + set STMT [sqlite3_prepare $::DB "INSERT INTO tbl2 VALUES(?, ?)" -1 TAIL] + sqlite3_bind_blob $::STMT 1 abc 3 + sqlite3_step $::STMT + sqlite3_finalize $::STMT + execsql { + SELECT quote(a), quote(b) FROM tbl2; + } +} {X'616263' NULL} + finish_test + diff --git a/test/subquery.test b/test/subquery.test index d159c11de8..0e517da435 100644 --- a/test/subquery.test +++ b/test/subquery.test @@ -11,12 +11,17 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing correlated subqueries # -# $Id: subquery.test,v 1.1 2005/01/21 02:34:44 drh Exp $ +# $Id: subquery.test,v 1.2 2005/01/21 11:55:28 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl +ifcapable !subquery { + finish_test + return +} + do_test subquery-1.1 { execsql { BEGIN;