aboutsummaryrefslogtreecommitdiff
path: root/src/delete.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2003-03-31 02:12:46 +0000
committerdrh <drh@noemail.net>2003-03-31 02:12:46 +0000
commitda93d238c2067a1951b8043c3c30355947fd6da9 (patch)
tree29057f4a84763deb95565d3e8bd2622614c85c15 /src/delete.c
parent1c2d84148a6bb2f8d231debd65bc09e948abf029 (diff)
downloadsqlite-da93d238c2067a1951b8043c3c30355947fd6da9.tar.gz
sqlite-da93d238c2067a1951b8043c3c30355947fd6da9.zip
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
Diffstat (limited to 'src/delete.c')
-rw-r--r--src/delete.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/delete.c b/src/delete.c
index 7fc2ddf91..fecb8cc12 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
** 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;