diff --git a/manifest b/manifest index 17009a8f99..ee0b6ac9f0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bug-fixes\sto\sget\sthe\stwo\sthreadtest\sC\sprograms\sworking\sagain.\s(CVS\s1756) -D 2004-06-29T07:45:33 +C Fix\serror\sreporting\spath\sfor\serrors\sthat\soccur\swhile\sreading\sthe\sdatabase\nschema.\s(CVS\s1757) +D 2004-06-29T08:59:35 F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -24,11 +24,11 @@ F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2 F sqlite3.def 26f4e7b0a3fbaa55701e020fdec429f1594e2866 -F src/attach.c 73b16e608fc662e8602639e946582832b6f2902b +F src/attach.c 678ded370e4b4d5bf03e9566404a42a8dcf5eef9 F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217 F src/btree.c ad428c56e42d748a0c1441fbbd93e41df407c31d F src/btree.h 934d0ad30b5b419e9291a11da878be349df2277e -F src/build.c ea8a3220574348b052e5c66e90c0619f3fd89863 +F src/build.c ecc10d4e5232a49f55304dd9b90739f2771e34ef F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1 F src/delete.c e81545e546f6bc87d7508a93a09ca70695265af3 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 @@ -38,7 +38,7 @@ F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/insert.c d99ffe87e1e1397f4233afcd06841d52d6b17b18 F src/legacy.c ad23746f15f67e34577621b1875f639c94839e1f -F src/main.c b2f25e2fe7ae2f930804694d01425f0ddfc51bee +F src/main.c c5cd98481abe99fe3061df2fc419427b18b998c4 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070 F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345 F src/os_common.h 1e745e582138c01d995f190d7544da3e826f6b2f @@ -53,13 +53,13 @@ F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44 F src/pager.c c1d5212e7cac86bc1a29d01a30d9dbbdb545dfd8 F src/pager.h fe818866f6d1adcffeed88705e8df7e588cbaf13 F src/parse.y e19e066e726a31d7b2d3e6475bdf55f7e339f8a3 -F src/pragma.c b6df973670332adc6c211b111ee41dcf31ac183f +F src/pragma.c 0ecbe7ccf78ad893f5011516845c9e2f74faa21a F src/printf.c 3090c8ff397d549bc0de09b16d8ab7fd37a0c3f7 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/select.c f02a65af34231031896e8442161cb5251e191e75 F src/shell.c 24b641700c9d90f361fcfa4f432c5b4aff704e6d F src/sqlite.h.in b70fded2bdfeaddfb06adea3888118b722975136 -F src/sqliteInt.h fedb84ed45a0019ca6ea77c815942f6397cb46a0 +F src/sqliteInt.h 4f8d44f04cc51cb421bf3c195247353a5be2e98f F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 F src/tclsqlite.c 8d093146332b2f0cbf2a8ebe8597d481619308a3 F src/test1.c 0eca68f6e70069aad7ad0fd91fda886926646786 @@ -68,7 +68,7 @@ F src/test3.c bacc42bf41fa04d6faf7dd104b595b8bafb9aec9 F src/test4.c a921a69821fd30209589228e64f94e9f715b6fe2 F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1 F src/tokenize.c 900374b6b37f04748bcd48c2d29a41c251542935 -F src/trigger.c 296e888ae931e9774e1761996b2b66db40f7d216 +F src/trigger.c 6aaf6d79cc2157c70a06031dd1531707d644cfb4 F src/update.c b66b1896c9da54678ba3eff2bf0b4d291a95986a F src/utf.c f03535db72bfa09e24202ccdd245f21d2fc65f0a F src/util.c 43d0289d49f43c66847ebbeddfb85a2a0d1ddd2d @@ -96,7 +96,7 @@ F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2 F test/btree6.test a5ede6bfbbb2ec8b27e62813612c0f28e8f3e027 F test/btree7.test 429b96cfef5b51a7d512cfb4b5b3e453384af293 F test/capi2.test fe61f341e953f73c29bacfcbdaf688cd7b0e0d38 -F test/capi3.test b05be389b8106c83b78db7a3ca3f7cb1e96d163e +F test/capi3.test c6af4822903c947da586c87811caec95e7a9da13 F test/collate1.test 2ee4fa3a47a652ccf56c5ddf65dcc44d9bad82ef F test/collate2.test c1a3b41f761b28853c5696037f92de928f93233b F test/collate3.test e60b428e07ec945492ba90ff1c895902ee3a8a50 @@ -231,7 +231,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P a8417cb83e9d070f46e7505f92a95f057b992658 -R f6a3ab8dfc5160d3b6066eb0982690ff +P ffd3312b66e2657c3431eab814aadec254af2403 +R 63c7d18bf59f5e6712d62a6fd6e5946d U danielk1977 -Z 627f904ea791eadd909ab90d3df46fcf +Z f7e74128acc3daa4896fa3764474c95e diff --git a/manifest.uuid b/manifest.uuid index 9ff384807a..61a77732e2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ffd3312b66e2657c3431eab814aadec254af2403 \ No newline at end of file +157db33e09399f31bcdaf58ea90fe618fefcd9bd \ No newline at end of file diff --git a/src/attach.c b/src/attach.c index f1f85e45d1..c67468baec 100644 --- a/src/attach.c +++ b/src/attach.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** -** $Id: attach.c,v 1.19 2004/06/28 01:11:46 danielk1977 Exp $ +** $Id: attach.c,v 1.20 2004/06/29 08:59:35 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -109,7 +109,7 @@ void sqlite3Attach(Parse *pParse, Token *pFilename, Token *pDbname, Token *pKey) db->flags &= ~SQLITE_Initialized; if( pParse->nErr ) return; if( rc==SQLITE_OK ){ - rc = sqlite3ReadSchema(pParse->db, &pParse->zErrMsg); + rc = sqlite3ReadSchema(pParse); } if( rc ){ int i = db->nDb - 1; @@ -119,8 +119,10 @@ void sqlite3Attach(Parse *pParse, Token *pFilename, Token *pDbname, Token *pKey) db->aDb[i].pBt = 0; } sqlite3ResetInternalSchema(db, 0); - pParse->nErr++; - pParse->rc = SQLITE_ERROR; + if( 0==pParse->nErr ){ + pParse->nErr++; + pParse->rc = SQLITE_ERROR; + } } } diff --git a/src/build.c b/src/build.c index e785f16518..8f2348d1b5 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.236 2004/06/29 07:45:33 danielk1977 Exp $ +** $Id: build.c,v 1.237 2004/06/29 08:59:35 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -104,25 +104,23 @@ void sqlite3FinishCoding(Parse *pParse){ } /* -** Locate the in-memory structure that describes -** a particular database table given the name -** of that table and (optionally) the name of the database -** containing the table. Return NULL if not found. +** Locate the in-memory structure that describes a particular database +** table given the name of that table and (optionally) the name of the +** database containing the table. Return NULL if not found. ** -** If zDatabase is 0, all databases are searched for the -** table and the first matching table is returned. (No checking -** for duplicate table names is done.) The search order is -** TEMP first, then MAIN, then any auxiliary databases added -** using the ATTACH command. +** If zDatabase is 0, all databases are searched for the table and the +** first matching table is returned. (No checking for duplicate table +** names is done.) The search order is TEMP first, then MAIN, then any +** auxiliary databases added using the ATTACH command. ** ** See also sqlite3LocateTable(). */ Table *sqlite3FindTable(sqlite *db, const char *zName, const char *zDatabase){ Table *p = 0; int i; - int rc = sqlite3ReadSchema(db, 0); assert( zName!=0 ); - for(i=0; rc==SQLITE_OK && inDb; i++){ + assert( (db->flags & SQLITE_Initialized) || db->init.busy ); + for(i=0; inDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue; p = sqlite3HashFind(&db->aDb[j].tblHash, zName, strlen(zName)+1); @@ -132,27 +130,27 @@ Table *sqlite3FindTable(sqlite *db, const char *zName, const char *zDatabase){ } /* -** Locate the in-memory structure that describes -** a particular database table given the name -** of that table and (optionally) the name of the database -** containing the table. Return NULL if not found. -** Also leave an error message in pParse->zErrMsg. +** Locate the in-memory structure that describes a particular database +** table given the name of that table and (optionally) the name of the +** database containing the table. Return NULL if not found. Also leave an +** error message in pParse->zErrMsg. ** -** The difference between this routine and sqlite3FindTable() -** is that this routine leaves an error message in pParse->zErrMsg -** where sqlite3FindTable() does not. +** The difference between this routine and sqlite3FindTable() is that this +** routine leaves an error message in pParse->zErrMsg where +** sqlite3FindTable() does not. */ Table *sqlite3LocateTable(Parse *pParse, const char *zName, const char *zDbase){ Table *p; + /* Read the database schema. If an error occurs, leave an error message + ** and code in pParse and return NULL. */ + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ + return 0; + } + p = sqlite3FindTable(pParse->db, zName, zDbase); if( p==0 ){ - if( !(pParse->db->flags & SQLITE_Initialized) ){ - /* If the schema is not initialised at this point, it must be because - ** the database is locked. */ - pParse->nErr++; - pParse->rc = SQLITE_BUSY; - }else if( zDbase ){ + if( zDbase ){ sqlite3ErrorMsg(pParse, "no such table: %s.%s", zDbase, zName); }else if( sqlite3FindTable(pParse->db, zName, 0)!=0 ){ sqlite3ErrorMsg(pParse, "table \"%s\" is not in database \"%s\"", @@ -180,8 +178,8 @@ Table *sqlite3LocateTable(Parse *pParse, const char *zName, const char *zDbase){ Index *sqlite3FindIndex(sqlite *db, const char *zName, const char *zDb){ Index *p = 0; int i; - int rc = sqlite3ReadSchema(db, 0); - for(i=0; rc==SQLITE_OK && inDb; i++){ + assert( (db->flags & SQLITE_Initialized) || db->init.busy ); + for(i=0; inDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue; p = sqlite3HashFind(&db->aDb[j].idxHash, zName, strlen(zName)+1); @@ -642,14 +640,15 @@ void sqlite3StartTable( ** index or table name in the same database. Issue an error message if ** it does. */ + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) return; pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName); if( pTable ){ sqlite3ErrorMsg(pParse, "table %T already exists", pName); sqliteFree(zName); return; } - if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 && - (pIdx->iDb==0 || !db->init.busy) ){ + if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 && + ( iDb==0 || !db->init.busy) ){ sqlite3ErrorMsg(pParse, "there is already an index named %s", zName); sqliteFree(zName); return; @@ -1577,6 +1576,7 @@ static void sqliteViewResetAll(sqlite *db, int idx){ DbClearProperty(db, idx, DB_UnresetViews); } +#if 0 /* ** Given a token, look up a table with that name. If not found, leave ** an error for the parser to find and return NULL. @@ -1594,6 +1594,7 @@ Table *sqlite3TableFromToken(Parse *pParse, Token *pTok){ } return pTab; } +#endif /* ** This routine is called to do the work of a DROP TABLE statement. @@ -1958,6 +1959,7 @@ void sqlite3CreateIndex( */ if( pName ){ zName = sqlite3NameFromToken(pName); + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index; if( zName==0 ) goto exit_create_index; if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto exit_create_index; @@ -1965,6 +1967,7 @@ void sqlite3CreateIndex( if( !db->init.busy ){ Index *pISameName; /* Another index with the same name */ Table *pTSameName; /* A table with same name as the index */ + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index; if( (pISameName = sqlite3FindIndex(db, zName, db->aDb[iDb].zName))!=0 ){ sqlite3ErrorMsg(pParse, "index %s already exists", zName); goto exit_create_index; @@ -2242,6 +2245,7 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName){ if( pParse->nErr || sqlite3_malloc_failed ) return; assert( pName->nSrc==1 ); + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) return; pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase); if( pIndex==0 ){ sqlite3ErrorMsg(pParse, "no such index: %S", pName, 0); diff --git a/src/main.c b/src/main.c index 7f3f52b6ff..17a075613d 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.238 2004/06/29 07:45:34 danielk1977 Exp $ +** $Id: main.c,v 1.239 2004/06/29 08:59:35 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -376,15 +376,19 @@ int sqlite3Init(sqlite *db, char **pzErrMsg){ ** This routine is a no-op if the database schema is already initialised. ** Otherwise, the schema is loaded. An error code is returned. */ -int sqlite3ReadSchema(sqlite *db, char **pzErrMsg){ +int sqlite3ReadSchema(Parse *pParse){ int rc = SQLITE_OK; - + sqlite3 *db = pParse->db; if( !db->init.busy ){ if( (db->flags & SQLITE_Initialized)==0 ){ - rc = sqlite3Init(db, pzErrMsg); + rc = sqlite3Init(db, &pParse->zErrMsg); } } assert( rc!=SQLITE_OK || (db->flags & SQLITE_Initialized)||db->init.busy ); + if( rc!=SQLITE_OK ){ + pParse->rc = rc; + pParse->nErr++; + } return rc; } diff --git a/src/pragma.c b/src/pragma.c index a49de38b4c..c685b811b8 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.55 2004/06/29 07:45:34 danielk1977 Exp $ +** $Id: pragma.c,v 1.56 2004/06/29 08:59:35 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -115,19 +115,6 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ return 0; } -/* -** Check to make sure the schema is loaded. Return 1 if it is not. -*/ -static int checkSchema(Parse *pParse){ - int rc = sqlite3ReadSchema(pParse->db, &pParse->zErrMsg); - if( SQLITE_OK!=rc ){ - pParse->nErr++; - pParse->rc = rc; - return 1; - } - return 0; -} - /* ** Process a pragma statement. ** @@ -200,7 +187,7 @@ void sqlite3Pragma( { OP_Callback, 1, 0, 0}, }; int addr; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; if( !zRight ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "cache_size", P3_STATIC); @@ -241,7 +228,7 @@ void sqlite3Pragma( static VdbeOpList getCacheSize[] = { { OP_Callback, 1, 0, 0}, }; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; if( !zRight ){ int size = db->aDb[iDb].cache_size; assert( size>0 ); @@ -270,7 +257,7 @@ void sqlite3Pragma( static VdbeOpList getSync[] = { { OP_Callback, 1, 0, 0}, }; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; if( !zRight ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "synchronous", P3_STATIC); @@ -315,7 +302,7 @@ void sqlite3Pragma( */ if( sqlite3StrICmp(zLeft, "table_info")==0 && zRight ){ Table *pTab; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; pTab = sqlite3FindTable(db, zRight, 0); if( pTab ){ int i; @@ -344,7 +331,7 @@ void sqlite3Pragma( if( sqlite3StrICmp(zLeft, "index_info")==0 && zRight ){ Index *pIdx; Table *pTab; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; pIdx = sqlite3FindIndex(db, zRight, 0); if( pIdx ){ int i; @@ -367,7 +354,7 @@ void sqlite3Pragma( if( sqlite3StrICmp(zLeft, "index_list")==0 && zRight ){ Index *pIdx; Table *pTab; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; pTab = sqlite3FindTable(db, zRight, 0); if( pTab ){ v = sqlite3GetVdbe(pParse); @@ -393,7 +380,7 @@ void sqlite3Pragma( if( sqlite3StrICmp(zLeft, "foreign_key_list")==0 && zRight ){ FKey *pFK; Table *pTab; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; pTab = sqlite3FindTable(db, zRight, 0); if( pTab ){ v = sqlite3GetVdbe(pParse); @@ -426,7 +413,7 @@ void sqlite3Pragma( if( sqlite3StrICmp(zLeft, "database_list")==0 ){ int i; - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; sqlite3VdbeSetNumCols(v, 3); sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC); sqlite3VdbeSetColName(v, 1, "name", P3_STATIC); @@ -477,7 +464,7 @@ void sqlite3Pragma( }; /* Initialize the VDBE program */ - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "integrity_check", P3_STATIC); sqlite3VdbeAddOpList(v, ArraySize(initCode), initCode); @@ -625,7 +612,7 @@ void sqlite3Pragma( struct EncName *pEnc; encnames[6].enc = encnames[7].enc = SQLITE_UTF16NATIVE; if( !zRight ){ /* "PRAGMA encoding" */ - if( checkSchema(pParse) ) goto pragma_out; + if( sqlite3ReadSchema(pParse) ) goto pragma_out; sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "encoding", P3_STATIC); sqlite3VdbeAddOp(v, OP_String8, 0, 0); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index fde5bac5bc..c70871024c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.302 2004/06/28 13:09:11 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.303 2004/06/29 08:59:35 danielk1977 Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -1360,7 +1360,7 @@ void *sqlite3HexToBlob(const char *z); int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); const char *sqlite3ErrStr(int); int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold); -int sqlite3ReadSchema(sqlite *db, char **); +int sqlite3ReadSchema(Parse *pParse); CollSeq *sqlite3FindCollSeq(sqlite *,u8 enc, const char *,int,int); CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName, int nName); CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); diff --git a/src/trigger.c b/src/trigger.c index b0dcc4c278..4ece0557b5 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -404,18 +404,13 @@ void sqlite3DeleteTrigger(Trigger *pTrigger){ } /* - * This function is called to drop a trigger from the database schema. - * - * This may be called directly from the parser and therefore identifies - * the trigger by name. The sqlite3DropTriggerPtr() routine does the - * same job as this routine except it take a spointer to the trigger - * instead of the trigger name. - * - * Note that this function does not delete the trigger entirely. Instead it - * removes it from the internal schema and places it in the trigDrop hash - * table. This is so that the trigger can be restored into the database schema - * if the transaction is rolled back. - */ +** This function is called to drop a trigger from the database schema. +** +** This may be called directly from the parser and therefore identifies +** the trigger by name. The sqlite3DropTriggerPtr() routine does the +** same job as this routine except it takes a pointer to the trigger +** instead of the trigger name. +**/ void sqlite3DropTrigger(Parse *pParse, SrcList *pName){ Trigger *pTrigger = 0; int i; @@ -425,8 +420,7 @@ void sqlite3DropTrigger(Parse *pParse, SrcList *pName){ sqlite *db = pParse->db; if( sqlite3_malloc_failed ) goto drop_trigger_cleanup; - if( SQLITE_OK!=sqlite3ReadSchema(db, &pParse->zErrMsg) ){ - pParse->nErr++; + if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ goto drop_trigger_cleanup; } @@ -461,7 +455,7 @@ void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger, int nested){ sqlite *db = pParse->db; assert( pTrigger->iDbnDb ); - pTable = sqlite3FindTable(db, pTrigger->table,db->aDb[pTrigger->iTabDb].zName); + pTable = sqlite3FindTable(db,pTrigger->table,db->aDb[pTrigger->iTabDb].zName); assert(pTable); assert( pTable->iDb==pTrigger->iDb || pTrigger->iDb==1 ); #ifndef SQLITE_OMIT_AUTHORIZATION diff --git a/test/capi3.test b/test/capi3.test index 46a37c29dd..ecccbc0f48 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.14 2004/06/28 13:09:11 danielk1977 Exp $ +# $Id: capi3.test,v 1.15 2004/06/29 08:59:35 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -132,6 +132,9 @@ do_test capi3-3.4 { do_test capi3-3.5 { sqlite3_close $db2 } {SQLITE_OK} +do_test capi3-3.6 { + sqlite3_close $db2 +} {SQLITE_MISUSE} # rename sqlite3_open "" # rename sqlite3_open_old sqlite3_open @@ -453,4 +456,22 @@ do_test capi3-6.4 { sqlite3_close $DB } {SQLITE_OK} +# Test what happens when the library encounters a newer file format. +# Do this by updating the file format via the btree layer. +do_test capi3-7.1 { + set ::bt [btree_open test.db 10 0] + btree_begin_transaction $::bt + set meta [btree_get_meta $::bt] + lset meta 5 2 + eval [concat btree_update_meta $::bt $meta] + btree_commit $::bt + btree_close $::bt +} {} +do_test capi3-7.2 { + sqlite3 db test.db + catchsql { + SELECT * FROM sqlite_master; + } +} {1 {unsupported file format}} + finish_test