1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Changes to prepare.c and callback.c to promote better test coverage. (CVS 6770)

FossilOrigin-Name: 08cca219f16efab93cb00f04d2e2f8033893e5f1
This commit is contained in:
drh
2009-06-17 00:35:30 +00:00
parent 9da742f969
commit 58fbb314ae
4 changed files with 16 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
C Changes\ssqlite3_prepare_v2()\s(and\srelated\sroutines)\sso\sthat\sif\sit\sfails\sdue\r\nto\sa\smissing\stable\sand\sthe\sschema\sis\sout\sof\sdate,\sit\sretries\sonce\sbefore\r\nreturning\sSQLITE_SCHEMA.\s\sOther\schanges\sto\sprepare.c\sto\sfacilitate\scoverage\r\ntesting.\s(CVS\s6769) C Changes\sto\sprepare.c\sand\scallback.c\sto\spromote\sbetter\stest\scoverage.\s(CVS\s6770)
D 2009-06-16T17:49:36 D 2009-06-17T00:35:31
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -110,7 +110,7 @@ F src/btree.c 1edede2a80d466679754453794df2d9070bd14a8
F src/btree.h f70b694e8c163227369a66863b01fbff9009f323 F src/btree.h f70b694e8c163227369a66863b01fbff9009f323
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5 F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c 75b57e3f4de1b34d4e1e49d350dc87febff48ba0 F src/build.c 75b57e3f4de1b34d4e1e49d350dc87febff48ba0
F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686 F src/callback.c cb68b21b0d4ae7d11ae0e487933bce3323784dcf
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0 F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3 F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
F src/delete.c cb791855c7948cecc96def9d97989879ca26f257 F src/delete.c cb791855c7948cecc96def9d97989879ca26f257
@@ -153,7 +153,7 @@ F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d
F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324 F src/pcache.h 9b927ccc5a538e31b4c3bc7eec4f976db42a1324
F src/pcache1.c 97e7e8e6e34026fb43b47d08532b0c02e959c26c F src/pcache1.c 97e7e8e6e34026fb43b47d08532b0c02e959c26c
F src/pragma.c 06b3a4b93a5e587f1c04b4a40016eb360792cdf3 F src/pragma.c 06b3a4b93a5e587f1c04b4a40016eb360792cdf3
F src/prepare.c cc0cc08be09bef8b435fa3d4a5cb83e5eaddc9c9 F src/prepare.c aba6954623ad10e94c3eb30e6c2db5d709852bfc
F src/printf.c 508a1c59433353552b6553cba175eaa7331f8fc1 F src/printf.c 508a1c59433353552b6553cba175eaa7331f8fc1
F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628
F src/resolve.c 4a61d03e49b15440878096e6030863fc628828f0 F src/resolve.c 4a61d03e49b15440878096e6030863fc628828f0
@@ -734,7 +734,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 092b276e7d89bbfa3d8637a90ee5d458935a12a9 P 256ec3c6af41c2324db82e4deb54edbba5b581e8
R b6fd3af60cc74167321a8d8b03927552 R 90d0d60e7fa07ec7c8329901d91e782a
U drh U drh
Z 9f245bb4702e4a85aca9a1d8b8f3ca18 Z 8a31866b8d8ece00312850a3b9437909

View File

@@ -1 +1 @@
256ec3c6af41c2324db82e4deb54edbba5b581e8 08cca219f16efab93cb00f04d2e2f8033893e5f1

View File

@@ -13,7 +13,7 @@
** This file contains functions used to access the internal hash tables ** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences. ** 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" #include "sqliteInt.h"
@@ -124,9 +124,7 @@ int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
const char *zName = pColl->zName; const char *zName = pColl->zName;
CollSeq *p = sqlite3GetCollSeq(pParse->db, pColl, zName); CollSeq *p = sqlite3GetCollSeq(pParse->db, pColl, zName);
if( !p ){ if( !p ){
if( pParse->nErr==0 ){ sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName);
sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName);
}
pParse->nErr++; pParse->nErr++;
return SQLITE_ERROR; return SQLITE_ERROR;
} }
@@ -341,7 +339,6 @@ FuncDef *sqlite3FindFunction(
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); 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); h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a);
/* First search for a match amongst the application-defined functions. /* First search for a match amongst the application-defined functions.

View File

@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema ** interface, and routines that contribute to loading the database schema
** from disk. ** 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" #include "sqliteInt.h"
@@ -450,12 +450,13 @@ static int schemaIsValid(sqlite3 *db){
rc = sqlite3BtreeCursor(pBt, MASTER_ROOT, 0, 0, curTemp); rc = sqlite3BtreeCursor(pBt, MASTER_ROOT, 0, 0, curTemp);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie); 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; allOk = 0;
} }
sqlite3BtreeCloseCursor(curTemp); sqlite3BtreeCloseCursor(curTemp);
} }
if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ if( NEVER(rc==SQLITE_NOMEM) || rc==SQLITE_IOERR_NOMEM ){
db->mallocFailed = 1; db->mallocFailed = 1;
} }
} }
@@ -574,6 +575,8 @@ static int sqlite3Prepare(
if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){ if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
char *zSqlCopy; char *zSqlCopy;
int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
testcase( nBytes==mxLen );
testcase( nBytes==mxLen+1 );
if( nBytes>mxLen ){ if( nBytes>mxLen ){
sqlite3Error(db, SQLITE_TOOBIG, "statement too long"); sqlite3Error(db, SQLITE_TOOBIG, "statement too long");
(void)sqlite3SafetyOff(db); (void)sqlite3SafetyOff(db);