diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/alter.c | 6 | ||||
-rw-r--r-- | src/analyze.c | 6 | ||||
-rw-r--r-- | src/build.c | 19 | ||||
-rw-r--r-- | src/delete.c | 4 | ||||
-rw-r--r-- | src/insert.c | 4 | ||||
-rw-r--r-- | src/select.c | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/vdbeblob.c | 4 |
8 files changed, 29 insertions, 22 deletions
diff --git a/src/alter.c b/src/alter.c index c182c024b..63b0bd7d0 100644 --- a/src/alter.c +++ b/src/alter.c @@ -12,7 +12,7 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.40 2008/01/17 16:22:15 drh Exp $ +** $Id: alter.c,v 1.41 2008/01/25 15:04:48 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -291,7 +291,7 @@ void sqlite3AlterRenameTable( assert( pSrc->nSrc==1 ); assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); + pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase); if( !pTab ) goto exit_rename_table; iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); zDb = db->aDb[iDb].zName; @@ -569,7 +569,7 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ assert( pParse->pNewTable==0 ); assert( sqlite3BtreeHoldsAllMutexes(db) ); if( db->mallocFailed ) goto exit_begin_add_column; - pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); + pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase); if( !pTab ) goto exit_begin_add_column; #ifndef SQLITE_OMIT_VIRTUALTABLE diff --git a/src/analyze.c b/src/analyze.c index 7fd616265..4168fe669 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code associated with the ANALYZE command. ** -** @(#) $Id: analyze.c,v 1.40 2008/01/23 03:03:05 drh Exp $ +** @(#) $Id: analyze.c,v 1.41 2008/01/25 15:04:49 drh Exp $ */ #ifndef SQLITE_OMIT_ANALYZE #include "sqliteInt.h" @@ -315,7 +315,7 @@ void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ }else{ z = sqlite3NameFromToken(db, pName1); if( z ){ - pTab = sqlite3LocateTable(pParse, z, 0); + pTab = sqlite3LocateTable(pParse, 0, z, 0); sqlite3_free(z); if( pTab ){ analyzeTable(pParse, pTab); @@ -329,7 +329,7 @@ void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ zDb = db->aDb[iDb].zName; z = sqlite3NameFromToken(db, pTableName); if( z ){ - pTab = sqlite3LocateTable(pParse, z, zDb); + pTab = sqlite3LocateTable(pParse, 0, z, zDb); sqlite3_free(z); if( pTab ){ analyzeTable(pParse, pTab); diff --git a/src/build.c b/src/build.c index 4deb5bd96..86109d152 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.470 2008/01/22 14:50:17 drh Exp $ +** $Id: build.c,v 1.471 2008/01/25 15:04:49 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -291,7 +291,12 @@ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){ ** routine leaves an error message in pParse->zErrMsg where ** sqlite3FindTable() does not. */ -Table *sqlite3LocateTable(Parse *pParse, const char *zName, const char *zDbase){ +Table *sqlite3LocateTable( + Parse *pParse, /* context in which to report errors */ + int isView, /* True if looking for a VIEW rather than a TABLE */ + const char *zName, /* Name of the table we are looking for */ + const char *zDbase /* Name of the database. Might be NULL */ +){ Table *p; /* Read the database schema. If an error occurs, leave an error message @@ -302,10 +307,11 @@ Table *sqlite3LocateTable(Parse *pParse, const char *zName, const char *zDbase){ p = sqlite3FindTable(pParse->db, zName, zDbase); if( p==0 ){ + const char *zMsg = isView ? "no such view" : "no such table"; if( zDbase ){ - sqlite3ErrorMsg(pParse, "no such table: %s.%s", zDbase, zName); + sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); }else{ - sqlite3ErrorMsg(pParse, "no such table: %s", zName); + sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); } pParse->checkSchema = 1; } @@ -1935,7 +1941,8 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ goto exit_drop_table; } assert( pName->nSrc==1 ); - pTab = sqlite3LocateTable(pParse, pName->a[0].zName, pName->a[0].zDatabase); + pTab = sqlite3LocateTable(pParse, isView, + pName->a[0].zName, pName->a[0].zDatabase); if( pTab==0 ){ if( noErr ){ @@ -2365,7 +2372,7 @@ void sqlite3CreateIndex( ** sqlite3FixSrcList can never fail. */ assert(0); } - pTab = sqlite3LocateTable(pParse, pTblName->a[0].zName, + pTab = sqlite3LocateTable(pParse, 0, pTblName->a[0].zName, pTblName->a[0].zDatabase); if( !pTab ) goto exit_create_index; assert( db->aDb[iDb].pSchema==pTab->pSchema ); diff --git a/src/delete.c b/src/delete.c index 9fe4ae8b2..5fffc8eab 100644 --- a/src/delete.c +++ b/src/delete.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** in order to generate code for DELETE FROM statements. ** -** $Id: delete.c,v 1.159 2008/01/17 16:22:15 drh Exp $ +** $Id: delete.c,v 1.160 2008/01/25 15:04:50 drh Exp $ */ #include "sqliteInt.h" @@ -26,7 +26,7 @@ Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ int i; struct SrcList_item *pItem; for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){ - pTab = sqlite3LocateTable(pParse, pItem->zName, pItem->zDatabase); + pTab = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase); sqlite3DeleteTable(pItem->pTab); pItem->pTab = pTab; if( pTab ){ diff --git a/src/insert.c b/src/insert.c index 13b3d02da..07b069c6f 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.227 2008/01/21 16:22:46 drh Exp $ +** $Id: insert.c,v 1.228 2008/01/25 15:04:50 drh Exp $ */ #include "sqliteInt.h" @@ -1518,7 +1518,7 @@ static int xferOptimization( ** we have to check the semantics. */ pItem = pSelect->pSrc->a; - pSrc = sqlite3LocateTable(pParse, pItem->zName, pItem->zDatabase); + pSrc = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase); if( pSrc==0 ){ return 0; /* FROM clause does not contain a real table */ } diff --git a/src/select.c b/src/select.c index 551de921b..981691f61 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.410 2008/01/24 14:27:44 danielk1977 Exp $ +** $Id: select.c,v 1.411 2008/01/25 15:04:50 drh Exp $ */ #include "sqliteInt.h" @@ -1306,7 +1306,7 @@ static int prepSelectStmt(Parse *pParse, Select *p){ /* An ordinary table or view name in the FROM clause */ assert( pFrom->pTab==0 ); pFrom->pTab = pTab = - sqlite3LocateTable(pParse,pFrom->zName,pFrom->zDatabase); + sqlite3LocateTable(pParse,0,pFrom->zName,pFrom->zDatabase); if( pTab==0 ){ return 1; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index f8393fe01..9d0ba4991 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.655 2008/01/23 14:51:50 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.656 2008/01/25 15:04:50 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -1776,7 +1776,7 @@ int sqlite3ExprCodeExprList(Parse*, ExprList*, int); void sqlite3ExprIfTrue(Parse*, Expr*, int, int); void sqlite3ExprIfFalse(Parse*, Expr*, int, int); Table *sqlite3FindTable(sqlite3*,const char*, const char*); -Table *sqlite3LocateTable(Parse*,const char*, const char*); +Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); Index *sqlite3FindIndex(sqlite3*,const char*, const char*); void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 6565294c6..70d5ed81f 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -12,7 +12,7 @@ ** ** This file contains code used to implement incremental BLOB I/O. ** -** $Id: vdbeblob.c,v 1.19 2008/01/23 03:03:05 drh Exp $ +** $Id: vdbeblob.c,v 1.20 2008/01/25 15:04:50 drh Exp $ */ #include "sqliteInt.h" @@ -102,7 +102,7 @@ int sqlite3_blob_open( } sqlite3BtreeEnterAll(db); - pTab = sqlite3LocateTable(&sParse, zTable, zDb); + pTab = sqlite3LocateTable(&sParse, 0, zTable, zDb); if( !pTab ){ if( sParse.zErrMsg ){ sqlite3_snprintf(sizeof(zErr), zErr, "%s", sParse.zErrMsg); |