mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-24 08:21:29 +03:00
Simplify the parser reduction code for the LIMIT clause on an UPDATE or
DELETE. (CVS 5792) FossilOrigin-Name: 3de179630e812396ec29e77f7a06758472d0802f
This commit is contained in:
21
src/parse.y
21
src/parse.y
@@ -14,7 +14,7 @@
|
||||
** the parser. Lemon will also generate a header file containing
|
||||
** numeric codes for all of the tokens.
|
||||
**
|
||||
** @(#) $Id: parse.y,v 1.256 2008/10/10 04:34:16 shane Exp $
|
||||
** @(#) $Id: parse.y,v 1.257 2008/10/10 14:27:17 drh Exp $
|
||||
*/
|
||||
|
||||
// All token codes are small integers with #defines that begin with "TK_"
|
||||
@@ -579,17 +579,14 @@ limit_opt(A) ::= LIMIT expr(X) COMMA expr(Y).
|
||||
/////////////////////////// The DELETE statement /////////////////////////////
|
||||
//
|
||||
%ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
|
||||
cmd ::= DELETE FROM fullname(X) indexed_opt(I) where_opt(W) orderby_opt(O) limit_opt(L). {
|
||||
cmd ::= DELETE FROM fullname(X) indexed_opt(I) where_opt(W)
|
||||
orderby_opt(O) limit_opt(L). {
|
||||
sqlite3SrcListIndexedBy(pParse, X, &I);
|
||||
if( O && !L.pLimit ){
|
||||
sqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on DELETE");
|
||||
pParse->parseError = 1;
|
||||
} else if (L.pLimit) {
|
||||
Expr *LW = sqlite3LimitWhere(pParse, X, W, O, L.pLimit, L.pOffset);
|
||||
if( LW ) {
|
||||
sqlite3DeleteFrom(pParse,X,LW);
|
||||
}
|
||||
} else {
|
||||
}else{
|
||||
W = sqlite3LimitWhere(pParse, X, W, O, L.pLimit, L.pOffset);
|
||||
sqlite3DeleteFrom(pParse,X,W);
|
||||
}
|
||||
}
|
||||
@@ -616,12 +613,8 @@ cmd ::= UPDATE orconf(R) fullname(X) indexed_opt(I) SET setlist(Y) where_opt(W)
|
||||
if( O && !L.pLimit ){
|
||||
sqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on UPDATE");
|
||||
pParse->parseError = 1;
|
||||
} else if (L.pLimit) {
|
||||
Expr *LW = sqlite3LimitWhere(pParse, X, W, O, L.pLimit,L.pOffset);
|
||||
if( LW ) {
|
||||
sqlite3Update(pParse,X,Y,LW,R);
|
||||
}
|
||||
} else {
|
||||
}else{
|
||||
W = sqlite3LimitWhere(pParse, X, W, O, L.pLimit,L.pOffset);
|
||||
sqlite3Update(pParse,X,Y,W,R);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user