/ Check-in [4cedc641]
Login

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

Overview
Comment:Disallow the ON CONFLICT clause on CHECK constraints. The syntax used to be allowed but never worked, so this should not present compatibility problems. Other internal grammar simplifications. (CVS 5546)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4cedc641ed39982ae8cbb9200aa1e2f37c878b73
User & Date: drh 2008-08-08 14:19:41
Context
2008-08-08
14:33
Round lookaside buffer sizes in the right direction. Ticket #3277. (CVS 5547) (check-in: c1a9bf38 user: drh tags: trunk)
14:19
Disallow the ON CONFLICT clause on CHECK constraints. The syntax used to be allowed but never worked, so this should not present compatibility problems. Other internal grammar simplifications. (CVS 5546) (check-in: 4cedc641 user: drh tags: trunk)
2008-08-07
13:05
Improved clarity of presentation in the tokenizer. (CVS 5545) (check-in: 732657c6 user: drh tags: trunk)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to addopcodes.awk.

    19     19     printf "#define TK_%-29s %4d\n", "TO_NUMERIC",      max+3
    20     20     printf "#define TK_%-29s %4d\n", "TO_INT",          max+4
    21     21     printf "#define TK_%-29s %4d\n", "TO_REAL",         max+5
    22     22     printf "#define TK_%-29s %4d\n", "END_OF_FILE",     max+6
    23     23     printf "#define TK_%-29s %4d\n", "ILLEGAL",         max+7
    24     24     printf "#define TK_%-29s %4d\n", "SPACE",           max+8
    25     25     printf "#define TK_%-29s %4d\n", "UNCLOSED_STRING", max+9
    26         -  printf "#define TK_%-29s %4d\n", "COMMENT",         max+10
    27         -  printf "#define TK_%-29s %4d\n", "FUNCTION",        max+11
    28         -  printf "#define TK_%-29s %4d\n", "COLUMN",          max+12
    29         -  printf "#define TK_%-29s %4d\n", "AGG_FUNCTION",    max+13
    30         -  printf "#define TK_%-29s %4d\n", "AGG_COLUMN",      max+14
    31         -  printf "#define TK_%-29s %4d\n", "CONST_FUNC",      max+15
           26  +  printf "#define TK_%-29s %4d\n", "FUNCTION",        max+10
           27  +  printf "#define TK_%-29s %4d\n", "COLUMN",          max+11
           28  +  printf "#define TK_%-29s %4d\n", "AGG_FUNCTION",    max+12
           29  +  printf "#define TK_%-29s %4d\n", "AGG_COLUMN",      max+13
           30  +  printf "#define TK_%-29s %4d\n", "CONST_FUNC",      max+14
    32     31   }

Changes to src/alter.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that used to generate VDBE code
    13     13   ** that implements the ALTER TABLE command.
    14     14   **
    15         -** $Id: alter.c,v 1.47 2008/07/28 19:34:53 drh Exp $
           15  +** $Id: alter.c,v 1.48 2008/08/08 14:19:41 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #include <ctype.h>
    19     19   
    20     20   /*
    21     21   ** The code in this file only exists if we are not omitting the
    22     22   ** ALTER TABLE logic from the build.
................................................................................
    70     70   
    71     71         /* Advance zCsr to the next token. Store that token type in 'token',
    72     72         ** and its length in 'len' (to be used next iteration of this loop).
    73     73         */
    74     74         do {
    75     75           zCsr += len;
    76     76           len = sqlite3GetToken(zCsr, &token);
    77         -      } while( token==TK_SPACE || token==TK_COMMENT );
           77  +      } while( token==TK_SPACE );
    78     78         assert( len>0 );
    79     79       } while( token!=TK_LP && token!=TK_USING );
    80     80   
    81     81       zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", tname.z - zSql, zSql, 
    82     82          zTableName, tname.z+tname.n);
    83     83       sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
    84     84     }

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.248 2008/07/31 01:40:42 shane Exp $
           17  +** @(#) $Id: parse.y,v 1.249 2008/08/08 14:19:41 drh Exp $
    18     18   */
    19     19   
    20     20   // All token codes are small integers with #defines that begin with "TK_"
    21     21   %token_prefix TK_
    22     22   
    23     23   // The type of the data attached to each token is Token.  This is also the
    24     24   // default type for non-terminals.
................................................................................
    87     87   
    88     88   } // end %include
    89     89   
    90     90   // Input is a single SQL command
    91     91   input ::= cmdlist.
    92     92   cmdlist ::= cmdlist ecmd.
    93     93   cmdlist ::= ecmd.
    94         -cmdx ::= cmd.           { sqlite3FinishCoding(pParse); }
    95     94   ecmd ::= SEMI.
    96     95   ecmd ::= explain cmdx SEMI.
    97     96   explain ::= .           { sqlite3BeginParse(pParse, 0); }
    98     97   %ifndef SQLITE_OMIT_EXPLAIN
    99     98   explain ::= EXPLAIN.              { sqlite3BeginParse(pParse, 1); }
   100     99   explain ::= EXPLAIN QUERY PLAN.   { sqlite3BeginParse(pParse, 2); }
   101    100   %endif  SQLITE_OMIT_EXPLAIN
          101  +cmdx ::= cmd.           { sqlite3FinishCoding(pParse); }
   102    102   
   103    103   ///////////////////// Begin and end transactions. ////////////////////////////
   104    104   //
   105    105   
   106    106   cmd ::= BEGIN transtype(Y) trans_opt.  {sqlite3BeginTransaction(pParse, Y);}
   107    107   trans_opt ::= .
   108    108   trans_opt ::= TRANSACTION.
................................................................................
   309    309   conslist ::= conslist tcons.
   310    310   conslist ::= tcons.
   311    311   tcons ::= CONSTRAINT nm.
   312    312   tcons ::= PRIMARY KEY LP idxlist(X) autoinc(I) RP onconf(R).
   313    313                                            {sqlite3AddPrimaryKey(pParse,X,R,I,0);}
   314    314   tcons ::= UNIQUE LP idxlist(X) RP onconf(R).
   315    315                                    {sqlite3CreateIndex(pParse,0,0,0,X,R,0,0,0,0);}
   316         -tcons ::= CHECK LP expr(E) RP onconf. {sqlite3AddCheckConstraint(pParse,E);}
          316  +tcons ::= CHECK LP expr(E) RP. {sqlite3AddCheckConstraint(pParse,E);}
   317    317   tcons ::= FOREIGN KEY LP idxlist(FA) RP
   318    318             REFERENCES nm(T) idxlist_opt(TA) refargs(R) defer_subclause_opt(D). {
   319    319       sqlite3CreateForeignKey(pParse, FA, &T, TA, R);
   320    320       sqlite3DeferForeignKey(pParse, D);
   321    321   }
   322    322   %type defer_subclause_opt {int}
   323    323   defer_subclause_opt(A) ::= .                    {A = 0;}
................................................................................
   881    881   uniqueflag(A) ::= UNIQUE.  {A = OE_Abort;}
   882    882   uniqueflag(A) ::= .        {A = OE_None;}
   883    883   
   884    884   %type idxlist {ExprList*}
   885    885   %destructor idxlist {sqlite3ExprListDelete(pParse->db, $$);}
   886    886   %type idxlist_opt {ExprList*}
   887    887   %destructor idxlist_opt {sqlite3ExprListDelete(pParse->db, $$);}
   888         -%type idxitem {Token}
   889    888   
   890    889   idxlist_opt(A) ::= .                         {A = 0;}
   891    890   idxlist_opt(A) ::= LP idxlist(X) RP.         {A = X;}
   892         -idxlist(A) ::= idxlist(X) COMMA idxitem(Y) collate(C) sortorder(Z).  {
          891  +idxlist(A) ::= idxlist(X) COMMA nm(Y) collate(C) sortorder(Z).  {
   893    892     Expr *p = 0;
   894    893     if( C.n>0 ){
   895    894       p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
   896    895       sqlite3ExprSetColl(pParse, p, &C);
   897    896     }
   898    897     A = sqlite3ExprListAppend(pParse,X, p, &Y);
   899    898     sqlite3ExprListCheckLength(pParse, A, "index");
   900    899     if( A ) A->a[A->nExpr-1].sortOrder = Z;
   901    900   }
   902         -idxlist(A) ::= idxitem(Y) collate(C) sortorder(Z). {
          901  +idxlist(A) ::= nm(Y) collate(C) sortorder(Z). {
   903    902     Expr *p = 0;
   904    903     if( C.n>0 ){
   905    904       p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
   906    905       sqlite3ExprSetColl(pParse, p, &C);
   907    906     }
   908    907     A = sqlite3ExprListAppend(pParse,0, p, &Y);
   909    908     sqlite3ExprListCheckLength(pParse, A, "index");
   910    909     if( A ) A->a[A->nExpr-1].sortOrder = Z;
   911    910   }
   912         -idxitem(A) ::= nm(X).              {A = X;}
   913    911   
   914    912   %type collate {Token}
   915    913   collate(C) ::= .                {C.z = 0; C.n = 0;}
   916    914   collate(C) ::= COLLATE ids(X).   {C = X;}
   917    915   
   918    916   
   919    917   ///////////////////////////// The DROP INDEX command /////////////////////////

Changes to src/tokenize.c.

    11     11   *************************************************************************
    12     12   ** An tokenizer for SQL
    13     13   **
    14     14   ** This file contains C code that splits an SQL input string up into
    15     15   ** individual tokens and sends those tokens one-by-one over to the
    16     16   ** parser for analysis.
    17     17   **
    18         -** $Id: tokenize.c,v 1.149 2008/08/07 13:05:36 drh Exp $
           18  +** $Id: tokenize.c,v 1.150 2008/08/08 14:19:41 drh Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include <ctype.h>
    22     22   #include <stdlib.h>
    23     23   
    24     24   /*
    25     25   ** The charMap() macro maps alphabetic characters into their
................................................................................
   127    127         for(i=1; isspace(z[i]); i++){}
   128    128         *tokenType = TK_SPACE;
   129    129         return i;
   130    130       }
   131    131       case '-': {
   132    132         if( z[1]=='-' ){
   133    133           for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
   134         -        *tokenType = TK_COMMENT;
          134  +        *tokenType = TK_SPACE;
   135    135           return i;
   136    136         }
   137    137         *tokenType = TK_MINUS;
   138    138         return 1;
   139    139       }
   140    140       case '(': {
   141    141         *tokenType = TK_LP;
................................................................................
   160    160       case '/': {
   161    161         if( z[1]!='*' || z[2]==0 ){
   162    162           *tokenType = TK_SLASH;
   163    163           return 1;
   164    164         }
   165    165         for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
   166    166         if( c ) i++;
   167         -      *tokenType = TK_COMMENT;
          167  +      *tokenType = TK_SPACE;
   168    168         return i;
   169    169       }
   170    170       case '%': {
   171    171         *tokenType = TK_REM;
   172    172         return 1;
   173    173       }
   174    174       case '=': {
................................................................................
   416    416       pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType);
   417    417       i += pParse->sLastToken.n;
   418    418       if( i>mxSqlLen ){
   419    419         pParse->rc = SQLITE_TOOBIG;
   420    420         break;
   421    421       }
   422    422       switch( tokenType ){
   423         -      case TK_SPACE:
   424         -      case TK_COMMENT: {
          423  +      case TK_SPACE: {
   425    424           if( db->u1.isInterrupted ){
   426    425             pParse->rc = SQLITE_INTERRUPT;
   427    426             sqlite3SetString(pzErrMsg, db, "interrupt");
   428    427             goto abort_parse;
   429    428           }
   430    429           break;
   431    430         }