You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Thomas Fox (JIRA)" <ji...@apache.org> on 2014/09/09 00:29:29 UTC
[jira] [Assigned] (TORQUE-322) Support for SQL Set Operations
(UNION, INTERSECT, ...)
[ https://issues.apache.org/jira/browse/TORQUE-322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Fox reassigned TORQUE-322:
---------------------------------
Assignee: Thomas Fox
> Support for SQL Set Operations (UNION, INTERSECT, ...)
> ------------------------------------------------------
>
> Key: TORQUE-322
> URL: https://issues.apache.org/jira/browse/TORQUE-322
> Project: Torque
> Issue Type: New Feature
> Affects Versions: 4.0
> Reporter: Michael Wa
> Assignee: Thomas Fox
>
> * It would be nice to support sql constructs like:
> SELECT * FROM sales2005 UNION SELECT * FROM sales2006;
> * If you want to realize the UNION operator you have to do something like that:
> [...]
> Criteria criteriaA = new Criteria();
> criteriaA.where( ... );
> criteriaA.addSelectColumn(COLUMNX);
> Query queryA = SqlBuilder.buildQuery(criteriaA);
> String sqlA = queryA.toString();
> List<Object> replacementsA = queryA.getPreparedStatementReplacements();
> Criteria criteriaB = new Criteria();
> criteriaB.where( ... );
> criteriaB.addSelectColumn(...);
> Query queryB = SqlBuilder.buildQuery(criteriaB);
> String sqlB = queryB.toString();
> List<Object> replacementsB = queryB.getPreparedStatementReplacements();
> List<Object> replacements = Lists.newArrayList();
> replacements.addAll(replacementsA);
> replacements.addAll(replacementsB);
> String sql = COLUMNX + " IN (" + sqlA + " UNION " + sqlB + ")";
> mainCriteria.whereVerbatimSql(sql, replacements.toArray());
> [...]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org