Omit the LikeOp object from the parser. Change more sqlite3PExpr() calls into

sqlite3ExprAlloc() calls.

FossilOrigin-Name: 795454a3fa5f9ccc486593b5e16e8fad38c934fb
This commit is contained in:
drh 2016-09-24 17:42:43 +00:00
parent 87f0e9863d
commit 410c301fea
3 changed files with 23 additions and 33 deletions

View File

@ -1,5 +1,5 @@
C Add\s-DSQLITE_MAX_EXPR_DEPTH=0\sto\sthe\s--lean\soption\son\sspeed-check.sh.
D 2016-09-24T01:41:59.614
C Omit\sthe\sLikeOp\sobject\sfrom\sthe\sparser.\s\sChange\smore\ssqlite3PExpr()\scalls\sinto\nsqlite3ExprAlloc()\scalls.
D 2016-09-24T17:42:43.549
F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
@ -375,7 +375,7 @@ F src/os_win.c 520f23475f1de530c435d30b67b7b15fe90874b0
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c bf5b71bde3e9b6110e7d6990607db881f6a471a2
F src/pager.h 966d2769e76ae347c8a32c4165faf6e6cb64546d
F src/parse.y 028b531b442f06fd6f0177f6197f3384c7e6e538
F src/parse.y b556d432d8e03104d8a8dfe13641416fd894b314
F src/pcache.c 5583c8ade4b05075a60ba953ef471d1c1a9c05df
F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
F src/pcache1.c 4bb7a6a5300c67d0b033d25adb509c120c03e812
@ -1525,7 +1525,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 8a6ea455cd1bf42ae0a7f1f1789baf88d782db13
R c2a1fbf434060e5ae670df791d65f59d
P a8cb1390fc1234b2e925090c4d770cca5d587bea
R fa7d3ec531d0706f5c7953317248a4f0
U drh
Z e4f27d74e807f7370bdb607111a612f9
Z 1cbaf1fb8c7d4606c6693d2bf847d929

View File

@ -1 +1 @@
a8cb1390fc1234b2e925090c4d770cca5d587bea
795454a3fa5f9ccc486593b5e16e8fad38c934fb

View File

@ -80,15 +80,6 @@ struct LimitVal {
Expr *pOffset; /* The OFFSET expression. NULL if there is none */
};
/*
** An instance of this structure is used to store the LIKE,
** GLOB, NOT LIKE, and NOT GLOB operators.
*/
struct LikeOp {
Token eOperator; /* "like" or "glob" or "regexp" */
int bNot; /* True if the NOT keyword is present */
};
/*
** An instance of the following structure describes the event of a
** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT,
@ -100,11 +91,6 @@ struct LikeOp {
*/
struct TrigEvent { int a; IdList * b; };
/*
** An instance of this structure holds the ATTACH key and the key type.
*/
struct AttachKey { int type; Token key; };
/*
** Disable lookaside memory allocation for objects that might be
** shared across database connections.
@ -865,15 +851,15 @@ term(A) ::= NULL(X). {spanExpr(&A,pParse,@X,X);/*A-overwrites-X*/}
expr(A) ::= id(X). {spanExpr(&A,pParse,TK_ID,X); /*A-overwrites-X*/}
expr(A) ::= JOIN_KW(X). {spanExpr(&A,pParse,TK_ID,X); /*A-overwrites-X*/}
expr(A) ::= nm(X) DOT nm(Y). {
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &X, 1);
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &Y, 1);
spanSet(&A,&X,&Y); /*A-overwrites-X*/
A.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
}
expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Z);
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &X, 1);
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &Y, 1);
Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &Z, 1);
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
spanSet(&A,&X,&Z); /*A-overwrites-X*/
A.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
@ -976,25 +962,29 @@ expr(A) ::= expr(A) PLUS|MINUS(OP) expr(Y).
expr(A) ::= expr(A) STAR|SLASH|REM(OP) expr(Y).
{spanBinaryExpr(pParse,@OP,&A,&Y);}
expr(A) ::= expr(A) CONCAT(OP) expr(Y). {spanBinaryExpr(pParse,@OP,&A,&Y);}
%type likeop {struct LikeOp}
likeop(A) ::= LIKE_KW|MATCH(X). {A.eOperator = X; A.bNot = 0;/*A-overwrites-X*/}
likeop(A) ::= NOT LIKE_KW|MATCH(X). {A.eOperator = X; A.bNot = 1;}
%type likeop {Token}
likeop(A) ::= LIKE_KW|MATCH(X). {A=X;/*A-overwrites-X*/}
likeop(A) ::= NOT LIKE_KW|MATCH(X). {A=X; A.n|=0x80000000; /*A-overwrite-X*/}
expr(A) ::= expr(A) likeop(OP) expr(Y). [LIKE_KW] {
ExprList *pList;
int bNot = OP.n & 0x80000000;
OP.n &= 0x7fffffff;
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, A.pExpr);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
exprNot(pParse, OP.bNot, &A);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP);
exprNot(pParse, bNot, &A);
A.zEnd = Y.zEnd;
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
}
expr(A) ::= expr(A) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
ExprList *pList;
int bNot = OP.n & 0x80000000;
OP.n &= 0x7fffffff;
pList = sqlite3ExprListAppend(pParse,0, Y.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, A.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, E.pExpr);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
exprNot(pParse, OP.bNot, &A);
A.pExpr = sqlite3ExprFunction(pParse, pList, &OP);
exprNot(pParse, bNot, &A);
A.zEnd = E.zEnd;
if( A.pExpr ) A.pExpr->flags |= EP_InfixFunc;
}