summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-05-22 09:05:48 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-05-22 09:05:48 +0000
commit837f6d59717a2faa3a74aa5bf7e9e4b5df17c0f9 (patch)
tree70a322446e4a340591f1a77543eb44d757020801
parent45816cf5d6cf24c8456df017d0a34a8cc22f3d2d (diff)
merge sync
-rw-r--r--lib/libsqlite3/src/parse.y34
1 files changed, 16 insertions, 18 deletions
diff --git a/lib/libsqlite3/src/parse.y b/lib/libsqlite3/src/parse.y
index ed18e7f9737..94433d53917 100644
--- a/lib/libsqlite3/src/parse.y
+++ b/lib/libsqlite3/src/parse.y
@@ -75,7 +75,7 @@ struct LimitVal {
*/
struct LikeOp {
Token eOperator; /* "like" or "glob" or "regexp" */
- int not; /* True if the NOT keyword is present */
+ int bNot; /* True if the NOT keyword is present */
};
/*
@@ -185,6 +185,7 @@ column(A) ::= columnid(X) type carglist. {
columnid(A) ::= nm(X). {
sqlite3AddColumn(pParse,&X);
A = X;
+ pParse->constraintName.n = 0;
}
@@ -273,10 +274,9 @@ signed ::= minus_num.
// "carglist" is a list of additional constraints that come after the
// column name and column type in a CREATE TABLE statement.
//
-carglist ::= carglist carg.
+carglist ::= carglist ccons.
carglist ::= .
-carg ::= CONSTRAINT nm ccons.
-carg ::= ccons.
+ccons ::= CONSTRAINT nm(X). {pParse->constraintName = X;}
ccons ::= DEFAULT term(X). {sqlite3AddDefaultValue(pParse,&X);}
ccons ::= DEFAULT LP expr(X) RP. {sqlite3AddDefaultValue(pParse,&X);}
ccons ::= DEFAULT PLUS term(X). {sqlite3AddDefaultValue(pParse,&X);}
@@ -339,15 +339,13 @@ init_deferred_pred_opt(A) ::= . {A = 0;}
init_deferred_pred_opt(A) ::= INITIALLY DEFERRED. {A = 1;}
init_deferred_pred_opt(A) ::= INITIALLY IMMEDIATE. {A = 0;}
-// For the time being, the only constraint we care about is the primary
-// key and UNIQUE. Both create indices.
-//
-conslist_opt(A) ::= . {A.n = 0; A.z = 0;}
-conslist_opt(A) ::= COMMA(X) conslist. {A = X;}
-conslist ::= conslist COMMA tcons.
-conslist ::= conslist tcons.
+conslist_opt(A) ::= . {A.n = 0; A.z = 0;}
+conslist_opt(A) ::= COMMA(X) conslist. {A = X;}
+conslist ::= conslist tconscomma tcons.
conslist ::= tcons.
-tcons ::= CONSTRAINT nm.
+tconscomma ::= COMMA. {pParse->constraintName.n = 0;}
+tconscomma ::= .
+tcons ::= CONSTRAINT nm(X). {pParse->constraintName = X;}
tcons ::= PRIMARY KEY LP idxlist(X) autoinc(I) RP onconf(R).
{sqlite3AddPrimaryKey(pParse,X,R,I,0);}
tcons ::= UNIQUE LP idxlist(X) RP onconf(R).
@@ -881,16 +879,16 @@ expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y).
{spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
expr(A) ::= expr(X) CONCAT(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
%type likeop {struct LikeOp}
-likeop(A) ::= LIKE_KW(X). {A.eOperator = X; A.not = 0;}
-likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.not = 1;}
-likeop(A) ::= MATCH(X). {A.eOperator = X; A.not = 0;}
-likeop(A) ::= NOT MATCH(X). {A.eOperator = X; A.not = 1;}
+likeop(A) ::= LIKE_KW(X). {A.eOperator = X; A.bNot = 0;}
+likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.bNot = 1;}
+likeop(A) ::= MATCH(X). {A.eOperator = X; A.bNot = 0;}
+likeop(A) ::= NOT MATCH(X). {A.eOperator = X; A.bNot = 1;}
expr(A) ::= expr(X) likeop(OP) expr(Y). [LIKE_KW] {
ExprList *pList;
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
- if( OP.not ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
+ if( OP.bNot ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
A.zStart = X.zStart;
A.zEnd = Y.zEnd;
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
@@ -901,7 +899,7 @@ expr(A) ::= expr(X) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
pList = sqlite3ExprListAppend(pParse,pList, X.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
- if( OP.not ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
+ if( OP.bNot ) A.pExpr = sqlite3PExpr(pParse, TK_NOT, A.pExpr, 0, 0);
A.zStart = X.zStart;
A.zEnd = E.zEnd;
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;