diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/printf.c | 1 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 | ||||
-rw-r--r-- | src/util.c | 13 | ||||
-rw-r--r-- | src/vdbemem.c | 2 |
4 files changed, 16 insertions, 1 deletions
diff --git a/src/printf.c b/src/printf.c index 3a12f51b3..0f66bc29f 100644 --- a/src/printf.c +++ b/src/printf.c @@ -137,6 +137,7 @@ static void setStrAccumError(StrAccum *p, u8 eError){ assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG ); p->accError = eError; if( p->mxAlloc ) sqlite3_str_reset(p); + if( eError==SQLITE_TOOBIG ) sqlite3ErrorToParser(p->db, eError); } /* diff --git a/src/sqliteInt.h b/src/sqliteInt.h index ee3a7c552..72953e600 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3834,6 +3834,7 @@ char *sqlite3VMPrintf(sqlite3*,const char*, va_list); void sqlite3SetString(char **, sqlite3*, const char*); void sqlite3ErrorMsg(Parse*, const char*, ...); +int sqlite3ErrorToParser(sqlite3*,int); void sqlite3Dequote(char*); void sqlite3DequoteExpr(Expr*); void sqlite3TokenInit(Token*,char*); diff --git a/src/util.c b/src/util.c index 1d8699846..81d3bf36b 100644 --- a/src/util.c +++ b/src/util.c @@ -234,6 +234,19 @@ void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ } /* +** If database connection db is currently parsing SQL, then transfer +** error code errCode to that parser if the parser has not already +** encountered some other kind of error. +*/ +int sqlite3ErrorToParser(sqlite3 *db, int errCode){ + Parse *pParse; + if( db==0 || (pParse = db->pParse)==0 ) return errCode; + pParse->rc = errCode; + pParse->nErr++; + return errCode; +} + +/* ** Convert an SQL-style quoted string into a normal string by removing ** the quote characters. The conversion is done in-place. If the ** input does not begin with a quote character, then this routine diff --git a/src/vdbemem.c b/src/vdbemem.c index 06388bfc5..7e527bbd6 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1065,7 +1065,7 @@ int sqlite3VdbeMemSetStr( nAlloc += (enc==SQLITE_UTF8?1:2); } if( nByte>iLimit ){ - return SQLITE_TOOBIG; + return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG); } testcase( nAlloc==0 ); testcase( nAlloc==31 ); |