aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/callback.c7
-rw-r--r--src/prepare.c9
2 files changed, 8 insertions, 8 deletions
diff --git a/src/callback.c b/src/callback.c
index 9890155e4..fd4749826 100644
--- a/src/callback.c
+++ b/src/callback.c
@@ -13,7 +13,7 @@
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
-** $Id: callback.c,v 1.41 2009/05/20 02:40:46 drh Exp $
+** $Id: callback.c,v 1.42 2009/06/17 00:35:31 drh Exp $
*/
#include "sqliteInt.h"
@@ -124,9 +124,7 @@ int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
const char *zName = pColl->zName;
CollSeq *p = sqlite3GetCollSeq(pParse->db, pColl, zName);
if( !p ){
- if( pParse->nErr==0 ){
- sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName);
- }
+ sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName);
pParse->nErr++;
return SQLITE_ERROR;
}
@@ -341,7 +339,6 @@ FuncDef *sqlite3FindFunction(
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
- if( nArg<-1 ) nArg = -1;
h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a);
/* First search for a match amongst the application-defined functions.
diff --git a/src/prepare.c b/src/prepare.c
index 9e6b393bf..269199b5d 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
-** $Id: prepare.c,v 1.122 2009/06/16 17:49:36 drh Exp $
+** $Id: prepare.c,v 1.123 2009/06/17 00:35:31 drh Exp $
*/
#include "sqliteInt.h"
@@ -450,12 +450,13 @@ static int schemaIsValid(sqlite3 *db){
rc = sqlite3BtreeCursor(pBt, MASTER_ROOT, 0, 0, curTemp);
if( rc==SQLITE_OK ){
rc = sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie);
- if( rc==SQLITE_OK && cookie!=db->aDb[iDb].pSchema->schema_cookie ){
+ if( ALWAYS(rc==SQLITE_OK)
+ && cookie!=db->aDb[iDb].pSchema->schema_cookie ){
allOk = 0;
}
sqlite3BtreeCloseCursor(curTemp);
}
- if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
+ if( NEVER(rc==SQLITE_NOMEM) || rc==SQLITE_IOERR_NOMEM ){
db->mallocFailed = 1;
}
}
@@ -574,6 +575,8 @@ static int sqlite3Prepare(
if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
char *zSqlCopy;
int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
+ testcase( nBytes==mxLen );
+ testcase( nBytes==mxLen+1 );
if( nBytes>mxLen ){
sqlite3Error(db, SQLITE_TOOBIG, "statement too long");
(void)sqlite3SafetyOff(db);