diff options
author | drh <drh@noemail.net> | 2008-10-10 14:27:16 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-10-10 14:27:16 +0000 |
commit | 931577f1cc92d57fa134a11a52cee6fb095349af (patch) | |
tree | a745c54ce09d898096f2da29e410766befc879b1 /src | |
parent | b235db9c7b480513814377a3a237bbcb1430032a (diff) | |
download | sqlite-931577f1cc92d57fa134a11a52cee6fb095349af.tar.gz sqlite-931577f1cc92d57fa134a11a52cee6fb095349af.zip |
Simplify the parser reduction code for the LIMIT clause on an UPDATE or
DELETE. (CVS 5792)
FossilOrigin-Name: 3de179630e812396ec29e77f7a06758472d0802f
Diffstat (limited to 'src')
-rw-r--r-- | src/parse.y | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/parse.y b/src/parse.y index b2b341031..e8f317608 100644 --- a/src/parse.y +++ b/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); } } |