/ Check-in [763e6c9e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a minor problem in the code for determining whether or not an SQL statement is SQLITE_TOOBIG.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | exp-window-functions
Files: files | file ages | folders
SHA3-256: 763e6c9e2bbc0a6ef8d8361069bf7160790c9064f24f0e336b7ed85668735da9
User & Date: dan 2018-06-30 20:00:35
Context
2018-06-30
20:15
Merge implementation of SQL window functions from the exp-window-functions into trunk. check-in: 17198a12 user: dan tags: trunk
20:00
Fix a minor problem in the code for determining whether or not an SQL statement is SQLITE_TOOBIG. Closed-Leaf check-in: 763e6c9e user: dan tags: exp-window-functions
19:12
Merge all changes from the weak-fallback branch except those related to the weak-fallback feature itself. check-in: aad718fb user: dan tags: exp-window-functions
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

    70     70         /* Advance zCsr to the next token. Store that token type in 'token',
    71     71         ** and its length in 'len' (to be used next iteration of this loop).
    72     72         */
    73     73         do {
    74     74           zCsr += len;
    75     75           len = sqlite3GetToken(zCsr, &token);
    76     76         } while( token==TK_SPACE );
    77         -      assert( len>0 );
           77  +      assert( len>0 || !*zCsr );
    78     78       } while( token!=TK_LP && token!=TK_USING );
    79     79   
    80     80       zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql),
    81     81          zSql, zTableName, tname.z+tname.n);
    82     82       sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
    83     83     }
    84     84   }
................................................................................
   194    194         /* Advance zCsr to the next token. Store that token type in 'token',
   195    195         ** and its length in 'len' (to be used next iteration of this loop).
   196    196         */
   197    197         do {
   198    198           zCsr += len;
   199    199           len = sqlite3GetToken(zCsr, &token);
   200    200         }while( token==TK_SPACE );
   201         -      assert( len>0 );
          201  +      assert( len>0 || !*zCsr );
   202    202   
   203    203         /* Variable 'dist' stores the number of tokens read since the most
   204    204         ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN 
   205    205         ** token is read and 'dist' equals 2, the condition stated above
   206    206         ** to be met.
   207    207         **
   208    208         ** Note that ON cannot be a database, table or column name, so

Changes to src/tokenize.c.

    50     50   #define CC_STAR      21    /* '*' */
    51     51   #define CC_PERCENT   22    /* '%' */
    52     52   #define CC_COMMA     23    /* ',' */
    53     53   #define CC_AND       24    /* '&' */
    54     54   #define CC_TILDA     25    /* '~' */
    55     55   #define CC_DOT       26    /* '.' */
    56     56   #define CC_ILLEGAL   27    /* Illegal character */
           57  +#define CC_NUL       28    /* 0x00 */
    57     58   
    58     59   static const unsigned char aiClass[] = {
    59     60   #ifdef SQLITE_ASCII
    60     61   /*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */
    61         -/* 0x */   27, 27, 27, 27, 27, 27, 27, 27, 27,  7,  7, 27,  7,  7, 27, 27,
           62  +/* 0x */   28, 27, 27, 27, 27, 27, 27, 27, 27,  7,  7, 27,  7,  7, 27, 27,
    62     63   /* 1x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
    63     64   /* 2x */    7, 15,  8,  5,  4, 22, 24,  8, 17, 18, 21, 20, 23, 11, 26, 16,
    64     65   /* 3x */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  5, 19, 12, 14, 13,  6,
    65     66   /* 4x */    5,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
    66     67   /* 5x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  9, 27, 27, 27,  1,
    67     68   /* 6x */    8,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
    68     69   /* 7x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1, 27, 10, 27, 25, 27,
................................................................................
   527    528   #endif
   528    529         /* If it is not a BLOB literal, then it must be an ID, since no
   529    530         ** SQL keywords start with the letter 'x'.  Fall through */
   530    531       }
   531    532       case CC_ID: {
   532    533         i = 1;
   533    534         break;
          535  +    }
          536  +    case CC_NUL: {
          537  +      *tokenType = TK_ILLEGAL;
          538  +      return 0;
   534    539       }
   535    540       default: {
   536    541         *tokenType = TK_ILLEGAL;
   537    542         return 1;
   538    543       }
   539    544     }
   540    545     while( IdChar(z[i]) ){ i++; }