From: drh Date: Tue, 9 Jun 2009 18:01:37 +0000 (+0000) Subject: Changes to tokenize.c to facilitate full coverage testing. (CVS 6738) X-Git-Tag: version-3.6.15~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19f81f6cdde147c4cd45ad8f397c1fc77cf1a1da;p=thirdparty%2Fsqlite.git Changes to tokenize.c to facilitate full coverage testing. (CVS 6738) FossilOrigin-Name: 5e8c48cff7e96e6030b796dba409844f4c758a60 --- diff --git a/manifest b/manifest index dec4e1ba90..45a1cdacb9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\ssavepoint4.test\sto\slimit\sdatabase\sgrowth.\sOtherwise\sthe\stest\scan\stake\sa\svery\slong\stime\sto\srun,\sdepending\son\sthe\sprng.\s(CVS\s6737) -D 2009-06-09T15:25:33 +C Changes\sto\stokenize.c\sto\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6738) +D 2009-06-09T18:01:38 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -197,7 +197,7 @@ F src/test_server.c f0a403b5f699c09bd2b1236b6f69830fd6221f6b F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4 F src/test_thread.c b8a1ab7ca1a632f18e8a361880d5d65eeea08eac F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241 -F src/tokenize.c 75367c7e4d2aee39a3b0496911284b73de5b4363 +F src/tokenize.c d8c6b39a6056db2b47a212607689dd7ee8031c69 F src/trigger.c c07c5157c58fcdb704f65d5f5e4775276e45bb8b F src/update.c 6ae6c26adff8dc34532d578f66e6cfde04b5d177 F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff @@ -733,7 +733,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P a7d0817c176832a88788cc973c0aae8dcab57364 -R 4eac5e8fb9c97abd8918163578f59db1 -U danielk1977 -Z 77827a69ee99e1935bb3859a0a751a0e +P ed1d4f47ee9a2bcafdee92ee6bfcb2b0d1758f76 +R a484012154ac91faa0af1a2719a7c8fa +U drh +Z 0d3e67979c087a1a6baac804f1996882 diff --git a/manifest.uuid b/manifest.uuid index 598ed34cc4..6a1073b767 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed1d4f47ee9a2bcafdee92ee6bfcb2b0d1758f76 \ No newline at end of file +5e8c48cff7e96e6030b796dba409844f4c758a60 \ No newline at end of file diff --git a/src/tokenize.c b/src/tokenize.c index 8bfda9bfdf..8784c3cba8 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.158 2009/05/28 01:00:55 drh Exp $ +** $Id: tokenize.c,v 1.159 2009/06/09 18:01:38 drh Exp $ */ #include "sqliteInt.h" #include @@ -123,6 +123,11 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ int i, c; switch( *z ){ case ' ': case '\t': case '\n': case '\f': case '\r': { + testcase( z[0]==' ' ); + testcase( z[0]=='\t' ); + testcase( z[0]=='\n' ); + testcase( z[0]=='\f' ); + testcase( z[0]=='\r' ); for(i=1; sqlite3Isspace(z[i]); i++){} *tokenType = TK_SPACE; return i; @@ -235,6 +240,9 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ case '\'': case '"': { int delim = z[0]; + testcase( delim=='`' ); + testcase( delim=='\'' ); + testcase( delim=='"' ); for(i=1; (c=z[i])!=0; i++){ if( c==delim ){ if( z[i+1]==delim ){ @@ -268,6 +276,10 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { + testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' ); + testcase( z[0]=='3' ); testcase( z[0]=='4' ); testcase( z[0]=='5' ); + testcase( z[0]=='6' ); testcase( z[0]=='7' ); testcase( z[0]=='8' ); + testcase( z[0]=='9' ); *tokenType = TK_INTEGER; for(i=0; sqlite3Isdigit(z[i]); i++){} #ifndef SQLITE_OMIT_FLOATING_POINT @@ -318,6 +330,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ #endif case '@': /* For compatibility with MS SQL Server */ case ':': { + testcase( z[0]=='$' ); testcase( z[0]=='@' ); testcase( z[0]==':' ); int n = 0; *tokenType = TK_VARIABLE; for(i=1; (c=z[i])!=0; i++){ @@ -346,6 +359,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ } #ifndef SQLITE_OMIT_BLOB_LITERAL case 'x': case 'X': { + testcase( z[0]=='x' ); testcase( z[0]=='X' ); if( z[1]=='\'' ){ *tokenType = TK_BLOB; for(i=2; (c=z[i])!=0 && c!='\''; i++){ @@ -424,8 +438,8 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ switch( tokenType ){ case TK_SPACE: { if( db->u1.isInterrupted ){ + sqlite3ErrorMsg(pParse, "interrupt"); pParse->rc = SQLITE_INTERRUPT; - sqlite3SetString(pzErrMsg, db, "interrupt"); goto abort_parse; } break; @@ -472,12 +486,9 @@ abort_parse: if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc)); } + assert( pzErrMsg!=0 ); if( pParse->zErrMsg ){ - if( *pzErrMsg==0 ){ - *pzErrMsg = pParse->zErrMsg; - }else{ - sqlite3DbFree(db, pParse->zErrMsg); - } + *pzErrMsg = pParse->zErrMsg; pParse->zErrMsg = 0; nErr++; }