mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Changes to tokenize.c to facilitate full coverage testing. (CVS 6738)
FossilOrigin-Name: 5e8c48cff7e96e6030b796dba409844f4c758a60
This commit is contained in:
14
manifest
14
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)
|
C Changes\sto\stokenize.c\sto\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6738)
|
||||||
D 2009-06-09T15:25:33
|
D 2009-06-09T18:01:38
|
||||||
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
|
||||||
@@ -197,7 +197,7 @@ F src/test_server.c f0a403b5f699c09bd2b1236b6f69830fd6221f6b
|
|||||||
F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4
|
F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4
|
||||||
F src/test_thread.c b8a1ab7ca1a632f18e8a361880d5d65eeea08eac
|
F src/test_thread.c b8a1ab7ca1a632f18e8a361880d5d65eeea08eac
|
||||||
F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241
|
F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241
|
||||||
F src/tokenize.c 75367c7e4d2aee39a3b0496911284b73de5b4363
|
F src/tokenize.c d8c6b39a6056db2b47a212607689dd7ee8031c69
|
||||||
F src/trigger.c c07c5157c58fcdb704f65d5f5e4775276e45bb8b
|
F src/trigger.c c07c5157c58fcdb704f65d5f5e4775276e45bb8b
|
||||||
F src/update.c 6ae6c26adff8dc34532d578f66e6cfde04b5d177
|
F src/update.c 6ae6c26adff8dc34532d578f66e6cfde04b5d177
|
||||||
F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff
|
F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff
|
||||||
@@ -733,7 +733,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 a7d0817c176832a88788cc973c0aae8dcab57364
|
P ed1d4f47ee9a2bcafdee92ee6bfcb2b0d1758f76
|
||||||
R 4eac5e8fb9c97abd8918163578f59db1
|
R a484012154ac91faa0af1a2719a7c8fa
|
||||||
U danielk1977
|
U drh
|
||||||
Z 77827a69ee99e1935bb3859a0a751a0e
|
Z 0d3e67979c087a1a6baac804f1996882
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
ed1d4f47ee9a2bcafdee92ee6bfcb2b0d1758f76
|
5e8c48cff7e96e6030b796dba409844f4c758a60
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
** individual tokens and sends those tokens one-by-one over to the
|
** individual tokens and sends those tokens one-by-one over to the
|
||||||
** parser for analysis.
|
** 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 "sqliteInt.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -123,6 +123,11 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
|||||||
int i, c;
|
int i, c;
|
||||||
switch( *z ){
|
switch( *z ){
|
||||||
case ' ': case '\t': case '\n': case '\f': case '\r': {
|
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++){}
|
for(i=1; sqlite3Isspace(z[i]); i++){}
|
||||||
*tokenType = TK_SPACE;
|
*tokenType = TK_SPACE;
|
||||||
return i;
|
return i;
|
||||||
@@ -235,6 +240,9 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
|||||||
case '\'':
|
case '\'':
|
||||||
case '"': {
|
case '"': {
|
||||||
int delim = z[0];
|
int delim = z[0];
|
||||||
|
testcase( delim=='`' );
|
||||||
|
testcase( delim=='\'' );
|
||||||
|
testcase( delim=='"' );
|
||||||
for(i=1; (c=z[i])!=0; i++){
|
for(i=1; (c=z[i])!=0; i++){
|
||||||
if( c==delim ){
|
if( c==delim ){
|
||||||
if( z[i+1]==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 '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9': {
|
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;
|
*tokenType = TK_INTEGER;
|
||||||
for(i=0; sqlite3Isdigit(z[i]); i++){}
|
for(i=0; sqlite3Isdigit(z[i]); i++){}
|
||||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||||
@@ -318,6 +330,7 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
|||||||
#endif
|
#endif
|
||||||
case '@': /* For compatibility with MS SQL Server */
|
case '@': /* For compatibility with MS SQL Server */
|
||||||
case ':': {
|
case ':': {
|
||||||
|
testcase( z[0]=='$' ); testcase( z[0]=='@' ); testcase( z[0]==':' );
|
||||||
int n = 0;
|
int n = 0;
|
||||||
*tokenType = TK_VARIABLE;
|
*tokenType = TK_VARIABLE;
|
||||||
for(i=1; (c=z[i])!=0; i++){
|
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
|
#ifndef SQLITE_OMIT_BLOB_LITERAL
|
||||||
case 'x': case 'X': {
|
case 'x': case 'X': {
|
||||||
|
testcase( z[0]=='x' ); testcase( z[0]=='X' );
|
||||||
if( z[1]=='\'' ){
|
if( z[1]=='\'' ){
|
||||||
*tokenType = TK_BLOB;
|
*tokenType = TK_BLOB;
|
||||||
for(i=2; (c=z[i])!=0 && c!='\''; i++){
|
for(i=2; (c=z[i])!=0 && c!='\''; i++){
|
||||||
@@ -424,8 +438,8 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
|||||||
switch( tokenType ){
|
switch( tokenType ){
|
||||||
case TK_SPACE: {
|
case TK_SPACE: {
|
||||||
if( db->u1.isInterrupted ){
|
if( db->u1.isInterrupted ){
|
||||||
|
sqlite3ErrorMsg(pParse, "interrupt");
|
||||||
pParse->rc = SQLITE_INTERRUPT;
|
pParse->rc = SQLITE_INTERRUPT;
|
||||||
sqlite3SetString(pzErrMsg, db, "interrupt");
|
|
||||||
goto abort_parse;
|
goto abort_parse;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -472,12 +486,9 @@ abort_parse:
|
|||||||
if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
|
if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
|
||||||
sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc));
|
sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc));
|
||||||
}
|
}
|
||||||
|
assert( pzErrMsg!=0 );
|
||||||
if( pParse->zErrMsg ){
|
if( pParse->zErrMsg ){
|
||||||
if( *pzErrMsg==0 ){
|
|
||||||
*pzErrMsg = pParse->zErrMsg;
|
*pzErrMsg = pParse->zErrMsg;
|
||||||
}else{
|
|
||||||
sqlite3DbFree(db, pParse->zErrMsg);
|
|
||||||
}
|
|
||||||
pParse->zErrMsg = 0;
|
pParse->zErrMsg = 0;
|
||||||
nErr++;
|
nErr++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user