This is an automated email from the ASF dual-hosted git repository. doebele pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/master by this push: new 4c3c6d61 EMPIREDB-456 DBCommand new function selectSetExpressions() 4c3c6d61 is described below commit 4c3c6d6135aa32fd1f921d3a39a3b9d6f062a425 Author: Rainer Döbele <rdoeb...@users.noreply.github.com> AuthorDate: Sun Jul 13 21:05:40 2025 +0200 EMPIREDB-456 DBCommand new function selectSetExpressions() --- .../main/java/org/apache/empire/db/DBCommand.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/empire-db/src/main/java/org/apache/empire/db/DBCommand.java b/empire-db/src/main/java/org/apache/empire/db/DBCommand.java index e04fd808..cf4af8a0 100644 --- a/empire-db/src/main/java/org/apache/empire/db/DBCommand.java +++ b/empire-db/src/main/java/org/apache/empire/db/DBCommand.java @@ -411,6 +411,37 @@ public abstract class DBCommand extends DBCommandExpr return this; } + /** + * Selects all set expressions + * i.e. converts all calls like + * cmd.set(COL.to(VALUE)) + * into a select of the form + * cmd.select(VALUE.as(COL)) + * @return itself (this) + */ + public final DBCommand selectSetExpressions(List<DBSetExpr> setExprList) + { + // Check null or empty + if (setExprList==null || setExprList.isEmpty()) + return this; + // convert set to select + for (DBSetExpr se : setExprList) + { + DBColumnExpr VAL = (DBColumnExpr)se.getValue(); + select(VAL.as(se.getColumn())); + } + return this; + } + + /** + * Selects all set expressions that have been set for this command + * @return itself (this) + */ + public final DBCommand selectSetExpressions() + { + return selectSetExpressions(this.set); + } + /** * Adds a list of columns with their qualified name to the select phrase of an sql statement. *