diff options
author | drh <drh@noemail.net> | 2009-06-17 00:35:30 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-06-17 00:35:30 +0000 |
commit | 58fbb314ae3749e026241f0a1d21bf445d3dbbe0 (patch) | |
tree | 27bd7de2874552052a5315e715372c7a929a6a97 /src | |
parent | 9da742f9695fb32d9e70f57eed5095846258ad7d (diff) | |
download | sqlite-58fbb314ae3749e026241f0a1d21bf445d3dbbe0.tar.gz sqlite-58fbb314ae3749e026241f0a1d21bf445d3dbbe0.zip |
Changes to prepare.c and callback.c to promote better test coverage. (CVS 6770)
FossilOrigin-Name: 08cca219f16efab93cb00f04d2e2f8033893e5f1
Diffstat (limited to 'src')
-rw-r--r-- | src/callback.c | 7 | ||||
-rw-r--r-- | src/prepare.c | 9 |
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); |