mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-06 15:49:35 +03:00
Add the sqliteErrorMsg() function and use it to generate error message
text during parsing and code generation. This simplifies the code somewhat and makes it easier to handle names with a database prefix. (CVS 891) FossilOrigin-Name: 1d3fc977211abdc7ba3fd51d661863e8ce5aef69
This commit is contained in:
16
src/delete.c
16
src/delete.c
@@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle DELETE FROM statements.
|
||||
**
|
||||
** $Id: delete.c,v 1.49 2003/03/27 13:50:00 drh Exp $
|
||||
** $Id: delete.c,v 1.50 2003/03/31 02:12:47 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -29,12 +29,7 @@ Table *sqliteSrcListLookup(Parse *pParse, SrcList *pSrc){
|
||||
const char *zDb = pSrc->a[i].zDatabase;
|
||||
pTab = sqliteFindTable(pParse->db, zTab, zDb);
|
||||
if( pTab==0 ){
|
||||
if( zDb==0 || zDb[0]==0 ){
|
||||
sqliteSetString(&pParse->zErrMsg, "no such table: ", zTab, 0);
|
||||
}else{
|
||||
sqliteSetString(&pParse->zErrMsg, "no such table: ", zDb, ".", zTab, 0);
|
||||
}
|
||||
pParse->nErr++;
|
||||
sqliteErrorMsg(pParse, "no such table: %S", pSrc, 0);
|
||||
break;
|
||||
}
|
||||
pSrc->a[i].pTab = pTab;
|
||||
@@ -49,10 +44,9 @@ Table *sqliteSrcListLookup(Parse *pParse, SrcList *pSrc){
|
||||
*/
|
||||
int sqliteIsReadOnly(Parse *pParse, Table *pTab){
|
||||
if( pTab->readOnly || pTab->pSelect ){
|
||||
sqliteSetString(&pParse->zErrMsg,
|
||||
pTab->pSelect ? "view " : "table ", pTab->zName,
|
||||
" may not be modified", 0);
|
||||
pParse->nErr++;
|
||||
sqliteErrorMsg(pParse, "%s %s may not be modified",
|
||||
pTab->pSelect ? "view" : "table",
|
||||
pTab->zName);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user