UnQL

Check-in [2dd4975e9c]
Login

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

Overview
Comment:Avoid concatenating multiple "syntax error" messages together.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2dd4975e9ceff365fecee9a3ea0816107f866d5d
User & Date: dan 2011-07-28 19:32:50
Context
2011-07-28
20:19
Make the max() and min() aggregate functions magnetic. check-in: fe083ef8a6 user: dan tags: trunk
19:32
Avoid concatenating multiple "syntax error" messages together. check-in: 2dd4975e9c user: dan tags: trunk
18:47
Allow correlated references to list variables in the outer query to be used as data sources in scalar sub-queries. check-in: f00265864e user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

413
414
415
416
417
418
419

420
421


422
423
424
425



426
427
428
429
430
431
432
compound(A) ::= esel(X) UNION(OP) esel(Y).     {A=compoundQuery(p,X,@OP,Y);}
compound(A) ::= esel(X) UNION ALL(OP) esel(Y). {A=compoundQuery(p,X,@OP,Y);}
compound(A) ::= esel(X) EXCEPT(OP) esel(Y).    {A=compoundQuery(p,X,@OP,Y);}
compound(A) ::= esel(X) INTERSECT(OP) esel(Y). {A=compoundQuery(p,X,@OP,Y);}
esel(A) ::= compound(X).                       {A = X;}
esel(A) ::= expr(X). {
  /* TODO: Fix these error messages */

  if( X->eClass!=XJD1_EXPR_Q ){
    xjd1ParseError(p, XJD1_SYNTAX, "syntax error");


  }else{
    A = X->u.subq.p;
    if( A->pOrderBy || A->pLimit ){
      xjd1ParseError(p, XJD1_SYNTAX, "syntax error");



    }
  }
}

selectcore(A) ::= SELECT 
  dist_opt(D) sel_result(S) from(F) where_opt(W) groupby_opt(G).
  {A = simpleQuery(p,D,S.pExpr,S.zAs,F,W,&G);}







>
|
|
>
>
|
|
|
|
>
>
>







413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
compound(A) ::= esel(X) UNION(OP) esel(Y).     {A=compoundQuery(p,X,@OP,Y);}
compound(A) ::= esel(X) UNION ALL(OP) esel(Y). {A=compoundQuery(p,X,@OP,Y);}
compound(A) ::= esel(X) EXCEPT(OP) esel(Y).    {A=compoundQuery(p,X,@OP,Y);}
compound(A) ::= esel(X) INTERSECT(OP) esel(Y). {A=compoundQuery(p,X,@OP,Y);}
esel(A) ::= compound(X).                       {A = X;}
esel(A) ::= expr(X). {
  /* TODO: Fix these error messages */
  if( p->errCode==XJD1_OK ){
    if( X->eClass!=XJD1_EXPR_Q ){
      xjd1ParseError(p, XJD1_SYNTAX,
        "syntax error near \"%.*s\"", p->sTok.n, p->sTok.z
      );
    }else{
      A = X->u.subq.p;
      if( A->pOrderBy || A->pLimit ){
        xjd1ParseError(p, XJD1_SYNTAX,
          "syntax error near \"%.*s\"", p->sTok.n, p->sTok.z
        );
      }
    }
  }
}

selectcore(A) ::= SELECT 
  dist_opt(D) sel_result(S) from(F) where_opt(W) groupby_opt(G).
  {A = simpleQuery(p,D,S.pExpr,S.zAs,F,W,&G);}

Changes to src/tokenize.c.

473
474
475
476
477
478
479

480
481
482
483
484


/*
** Set the error code and message for the Parse object passed as the
** first argument.
*/
void xjd1ParseError(Parse *p, int errCode, const char *zFormat, ...){
  va_list ap;

  p->errCode = errCode;
  va_start(ap, zFormat);
  xjd1StringVAppendF(&p->errMsg, zFormat, ap);
  va_end(ap);
}








>
|
|
|
|
|
>
473
474
475
476
477
478
479
480
481
482
483
484
485
486

/*
** Set the error code and message for the Parse object passed as the
** first argument.
*/
void xjd1ParseError(Parse *p, int errCode, const char *zFormat, ...){
  va_list ap;
  if( p->errCode==XJD1_OK ){
    p->errCode = errCode;
    va_start(ap, zFormat);
    xjd1StringVAppendF(&p->errMsg, zFormat, ap);
    va_end(ap);
  }
}

Changes to test/all.test.

6
7
8
9
10
11
12

.read base04.test
.read base05.test
.read base06.test
.read base07.test
.read base08.test
.read base09.test
.read base10.test








>
6
7
8
9
10
11
12
13
.read base04.test
.read base05.test
.read base06.test
.read base07.test
.read base08.test
.read base09.test
.read base10.test
.read error01.test