You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by de...@freenet.de on 2003/10/31 09:06:17 UTC

Problem OR\'ing criterias

Hello torque-users,

I have a problem with OR'ing criterias. 

The code is as follows:

---SNIP---

Criteria crit = new Criteria();
		
crit.or (SongsPeer.ARTIST,(Object)searchString,Criteria.LIKE);
crit.or (SongsPeer.TITLE,(Object)searchString,Criteria.LIKE);
crit.or (SongsPeer.ALBUM,(Object)searchString,Criteria.LIKE);

---SNIP---

I would expect the query to look sth. like this:

---SNIP---
...
FROM SONGS 
WHERE SONGS.ALBUM LIKE '%4%' OR SONGS.TITLE LIKE '%4%' OR SONGS.ARTIST LIKE '%4%'
---SNIP---

But instead it AND's all X LIKE Y's together... :-(

Maybe I missunderstood some of the basic concepts of torque... 

Can someone give me a hint please?

Thanks in advance
Denis


-- 
eBay - Jetzt besser einkaufen!
Ueber 1. Mio. Angebote. Startpreise ab EUR 1,-
http://www.freenet.de/tipp/shopping/ebay

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


Re: Problem OR\'ing criterias

Posted by Felipe Ramos <fr...@tissat.es>.
As far as I know, crit.or doesn't work.

You must use Criterion to make 'or' statements, look into de Criteria 
tutorial in the torque web.

denis.griesmeyer@freenet.de wrote:

>Hello torque-users,
>
>I have a problem with OR'ing criterias. 
>
>The code is as follows:
>
>---SNIP---
>
>Criteria crit = new Criteria();
>		
>crit.or (SongsPeer.ARTIST,(Object)searchString,Criteria.LIKE);
>crit.or (SongsPeer.TITLE,(Object)searchString,Criteria.LIKE);
>crit.or (SongsPeer.ALBUM,(Object)searchString,Criteria.LIKE);
>
>---SNIP---
>
>I would expect the query to look sth. like this:
>
>---SNIP---
>...
>FROM SONGS 
>WHERE SONGS.ALBUM LIKE '%4%' OR SONGS.TITLE LIKE '%4%' OR SONGS.ARTIST LIKE '%4%'
>---SNIP---
>
>But instead it AND's all X LIKE Y's together... :-(
>
>Maybe I missunderstood some of the basic concepts of torque... 
>
>Can someone give me a hint please?
>
>Thanks in advance
>Denis
>
>
>  
>

-- 
------------------------
Felipe Ramos
Tissat SA
C/ Orense 34-9ª
28020 Madrid
Tel: (+34) 91 4175913 
Fax: (+34) 91 4172914
Mail: framos@tissat.es
------------------------




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


Re: Problem OR\'ing criterias

Posted by Tulsi Das <qu...@yahoo.com>.
I had the exact same problem, it seems that or() adds "AND" to the
query string!

no time to check the source code yet... will let you know if something
arises

Tulsi

 --- denis.griesmeyer@freenet.de escribió: 
> Hello torque-users,
> 
> I have a problem with OR'ing criterias. 
> 
> The code is as follows:
> 
> ---SNIP---
> 
> Criteria crit = new Criteria();
> 		
> crit.or (SongsPeer.ARTIST,(Object)searchString,Criteria.LIKE);
> crit.or (SongsPeer.TITLE,(Object)searchString,Criteria.LIKE);
> crit.or (SongsPeer.ALBUM,(Object)searchString,Criteria.LIKE);
> 
> ---SNIP---
> 
> I would expect the query to look sth. like this:
> 
> ---SNIP---
> ...
> FROM SONGS 
> WHERE SONGS.ALBUM LIKE '%4%' OR SONGS.TITLE LIKE '%4%' OR
> SONGS.ARTIST LIKE '%4%'
> ---SNIP---
> 
> But instead it AND's all X LIKE Y's together... :-(
> 
> Maybe I missunderstood some of the basic concepts of torque... 
> 
> Can someone give me a hint please?
> 
> Thanks in advance
> Denis
> 
> 
> -- 
> eBay - Jetzt besser einkaufen!
> Ueber 1. Mio. Angebote. Startpreise ab EUR 1,-
> http://www.freenet.de/tipp/shopping/ebay
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>  

------------
Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: http://conexion.yahoo.com.ar

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