db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Carl <patrick.c...@web.de>
Subject Re: Combining Criteria with other than AND
Date Mon, 28 Apr 2008 15:29:47 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Have a look at
http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-db.html
Section "AND and OR operators"

Patrick

Oliver Bethge schrieb:
| Hello,
|
| I try to combine some Criteria with other operators than AND but it
seems not possible to me.
|
| Here an example of the SQL I nerly want but it shows the main problems:
|
| SELECT * FROM TABLE1 A, TABLE2 B WHERE A.KEY=B.KEY AND ((B.ORT='ORT1'
AND B.PLZ IN (12345,12346)) OR (B.ORT='ORT2' AND B.PLZ IN (12347,12348))
AND NOT (B.OTHER='7' AND B.OTHER2=8)
|
| Combinig Criteria with "AND NOT" looks impossible to me because of
line 358ff in org.apache.torque.util.Query:
|
|         if (!whereCriteria.isEmpty())
|         {
|             stmt.append(WHERE)
|                 .append(StringUtils.join(whereCriteria.iterator(), AND));
|         }
|
| So all Criteria will be connected by " AND ".
|
| I tryed to use Criteria.CUSTOM but its also not possible to Connect
them with " AND NOT ".
|
| Sometimes it schould be possible to get an SQL like
|
| SELECT * FROM TABLE1 A, TABLE2 B WHERE A.KEY=B.KEY AND NOT
(B.OTHER='7' AND B.OTHER2=8)
|
| so it is not enougth to get some braces oround the whole WHERE-Clause.
|
| Thanks,
|
|  Oliver Bethge
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
| For additional commands, e-mail: torque-user-help@db.apache.org
|

- --
Patrick Carl
mailto:patrick@carl.it                                http://carl.it
GnuPG-Fingerprint: 3599 02CF 0419 BCA6 6BAC 4B53 DB7C 1897 451C F498
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFIFe1r23wYl0Uc9JgRAnmyAJ46izaiyVwfwCnlq4XJR3Pl0lp3ngCfXH9k
2rmB6Gtj3evFloLaJYkqLl8=
=A77S
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message