db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fox (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TORQUE-322) Support for SQL Set Operations (UNION, INTERSECT, ...)
Date Tue, 16 Sep 2014 21:06:34 GMT

     [ https://issues.apache.org/jira/browse/TORQUE-322?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Fox resolved TORQUE-322.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 4.1

> 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
>             Fix For: 4.1
>
>
> * 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


Mime
View raw message