db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saravana Krishnan Kannan" <saravkr...@uky.edu>
Subject Re: Criteria with Like using Oracle
Date Wed, 09 Jun 2004 17:53:46 GMT

  Obviously Java needs a \ to be escaped. So if you want to denote a single \ inside a java
string you should put "\\" and to denote a \\ you need to use "\\\\". Now the question is
- whether your key in the table actually contains two "\" characters or its just that you
showed us an escaped representation in the mail. In either case I don't think I can help further
because I dont understand why a \% (no escape chars) will match a \ but not a \\.

Btw, you might also need to consider the fact that Oracle might be doing another level of
escaping the characters. I'm not sure though.


-----Original Message-----
From: "Joacim Turesson" <joacim.turesson@profuture.se>
To: <torque-user@db.apache.org>
Date: Wed, 9 Jun 2004 14:10:01 +0200
Subject: Criteria with Like using Oracle



I'm using Torque with Oracle9i and it works fine.


But now I have a problem with a select statement.

We have a node table that has a key, for instance:

*	\ (for root)
*	\\Folder1 <file:///\\Folder1> 
*	\\Folder1\Folder2 <file:///\\Folder1\Folder2> 


If I use the code in the end of this mail the query works fine for a search
from the root, that is "key like '\\%'.

But when the node key value is '\\Folder1\%' the like statement is not
generated, instead it becomes key='\Folder1\'


Does anyone have a clue what's going on?


The Code:


Criteria criteria = new Criteria();

criteria.add(NodePeer.LEVEL,node.getLevel() + 1);

String nodeKey = node.getKey() + "\\" + "%";

criteria.add(NodePeer.KEY, (Object)nodeKey, Criteria.LIKE);


List list = NodePeer.doSelect(criteria,connection);


Thanks in advance!


Best Regards


Joacim Turesson

PS It works fine if I use / instead of \ DS


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

View raw message