Index: src/parse.y ================================================================== --- src/parse.y +++ src/parse.y @@ -12,11 +12,11 @@ ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** 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_" %token_prefix TK_ @@ -577,21 +577,18 @@ {A.pOffset = X; A.pLimit = 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); } } %endif %ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT @@ -614,16 +611,12 @@ sqlite3SrcListIndexedBy(pParse, X, &I); sqlite3ExprListCheckLength(pParse,Y,"set list"); 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); } } %endif %ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT