diff options
author | drh <drh@noemail.net> | 2016-06-10 22:49:01 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-06-10 22:49:01 +0000 |
commit | 4d249e61289c76b41a880126ceb44bf97e14fb8b (patch) | |
tree | 3284cbe0d4a0eb68fbfeb707de618dbbcb0dea23 /src/build.c | |
parent | 8dc570b6afac593f029a67640ab916278af1ca65 (diff) | |
download | sqlite-4d249e61289c76b41a880126ceb44bf97e14fb8b.tar.gz sqlite-4d249e61289c76b41a880126ceb44bf97e14fb8b.zip |
Enhance "PRAGMA table_info" to that it provides information about eponymous
virtual tables.
FossilOrigin-Name: 53a1e5d51304cb3de700c1807a2c945a40240576
Diffstat (limited to 'src/build.c')
-rw-r--r-- | src/build.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/build.c b/src/build.c index c32195f65..52f6f200f 100644 --- a/src/build.c +++ b/src/build.c @@ -338,7 +338,7 @@ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){ */ Table *sqlite3LocateTable( Parse *pParse, /* context in which to report errors */ - int isView, /* True if looking for a VIEW rather than a TABLE */ + u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ const char *zName, /* Name of the table we are looking for */ const char *zDbase /* Name of the database. Might be NULL */ ){ @@ -352,7 +352,7 @@ Table *sqlite3LocateTable( p = sqlite3FindTable(pParse->db, zName, zDbase); if( p==0 ){ - const char *zMsg = isView ? "no such view" : "no such table"; + const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; #ifndef SQLITE_OMIT_VIRTUALTABLE if( sqlite3FindDbName(pParse->db, zDbase)<1 ){ /* If zName is the not the name of a table in the schema created using @@ -364,12 +364,14 @@ Table *sqlite3LocateTable( } } #endif - if( zDbase ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); - }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); + if( (flags & LOCATE_NOERR)==0 ){ + if( zDbase ){ + sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); + }else{ + sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); + } + pParse->checkSchema = 1; } - pParse->checkSchema = 1; } return p; @@ -386,7 +388,7 @@ Table *sqlite3LocateTable( */ Table *sqlite3LocateTableItem( Parse *pParse, - int isView, + u32 flags, struct SrcList_item *p ){ const char *zDb; @@ -397,7 +399,7 @@ Table *sqlite3LocateTableItem( }else{ zDb = p->zDatabase; } - return sqlite3LocateTable(pParse, isView, p->zName, zDb); + return sqlite3LocateTable(pParse, flags, p->zName, zDb); } /* @@ -2504,6 +2506,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ assert( pName->nSrc==1 ); if( sqlite3ReadSchema(pParse) ) goto exit_drop_table; if( noErr ) db->suppressErr++; + assert( isView==0 || isView==LOCATE_VIEW ); pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); if( noErr ) db->suppressErr--; |