2016-07-12 11:03 GMT+02:00 Chris Brody: > Personally I would really like to see this. Can you show the patch somewhere?
Here is the patch. I'm not sure that the SQLite mailing list accepts attachments, but your private mail surely does. The patch is generated against current SQLite trunk. Regards, Jan Nijtmans
Index: src/parse.y ================================================================== --- src/parse.y +++ src/parse.y @@ -735,54 +735,56 @@ limit_opt(A) ::= LIMIT expr(X) COMMA expr(Y). {A.pOffset = X.pExpr; A.pLimit = Y.pExpr;} /////////////////////////// The DELETE statement ///////////////////////////// // -%ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT cmd ::= with(C) DELETE FROM fullname(X) indexed_opt(I) where_opt(W) orderby_opt(O) limit_opt(L). { sqlite3WithPush(pParse, C, 1); sqlite3SrcListIndexedBy(pParse, X, &I); +#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) W = sqlite3LimitWhere(pParse, X, W, O, L.pLimit, L.pOffset, "DELETE"); - sqlite3DeleteFrom(pParse,X,W); -} -%endif -%ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT -cmd ::= with(C) DELETE FROM fullname(X) indexed_opt(I) where_opt(W). { - sqlite3WithPush(pParse, C, 1); - sqlite3SrcListIndexedBy(pParse, X, &I); +#else + if( O || L.pLimit ){ + sqlite3ErrorMsg(pParse, "%s on DELETE not supported", O?"ORDER BY":"LIMIT"); + sqlite3ExprDelete(pParse->db, W); + sqlite3ExprListDelete(pParse->db, O); + sqlite3ExprDelete(pParse->db, L.pLimit); + sqlite3ExprDelete(pParse->db, L.pOffset); + W = 0; + } +#endif sqlite3DeleteFrom(pParse,X,W); } -%endif %type where_opt {Expr*} %destructor where_opt {sqlite3ExprDelete(pParse->db, $$);} where_opt(A) ::= . {A = 0;} where_opt(A) ::= WHERE expr(X). {A = X.pExpr;} ////////////////////////// The UPDATE command //////////////////////////////// // -%ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT cmd ::= with(C) UPDATE orconf(R) fullname(X) indexed_opt(I) SET setlist(Y) where_opt(W) orderby_opt(O) limit_opt(L). { sqlite3WithPush(pParse, C, 1); sqlite3SrcListIndexedBy(pParse, X, &I); sqlite3ExprListCheckLength(pParse,Y,"set list"); +#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) W = sqlite3LimitWhere(pParse, X, W, O, L.pLimit, L.pOffset, "UPDATE"); - sqlite3Update(pParse,X,Y,W,R); -} -%endif -%ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT -cmd ::= with(C) UPDATE orconf(R) fullname(X) indexed_opt(I) SET setlist(Y) - where_opt(W). { - sqlite3WithPush(pParse, C, 1); - sqlite3SrcListIndexedBy(pParse, X, &I); - sqlite3ExprListCheckLength(pParse,Y,"set list"); +#else + if( O || L.pLimit ){ + sqlite3ErrorMsg(pParse, "%s on UPDATE not supported", O?"ORDER BY":"LIMIT"); + sqlite3ExprDelete(pParse->db, W); + sqlite3ExprListDelete(pParse->db, O); + sqlite3ExprDelete(pParse->db, L.pLimit); + sqlite3ExprDelete(pParse->db, L.pOffset); + W = 0; + } +#endif sqlite3Update(pParse,X,Y,W,R); } -%endif %type setlist {ExprList*} %destructor setlist {sqlite3ExprListDelete(pParse->db, $$);} setlist(A) ::= setlist(A) COMMA nm(X) EQ expr(Y). {
_______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users