cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Zeigler <robert.zeig...@roxanemy.com>
Subject Re: SQLTemplate Velocity lexical error
Date Tue, 17 May 2011 15:15:21 GMT
... I'm still not 100% clear why this precludes using SQLTemplate parameters? If you're generating
the SQL, you can also generate the parameter in the SQL... right?

Robert

On May 17, 2011, at 5/179:52 AM , Laurent Marchal wrote:

> I can't use SQL parameters becauseI do some dirty stuff : I have factories of lightweight
non-persitent objects created from datarows where the SQL is generated. I'm not proud of this
but  we didn't find any other solutions with cayenne...
> 
> Thanks
> Laurent.
> 
> 
> Le 05/16/2011 03:52 PM, Robert Zeigler a écrit :
>> Why can't you use sql parameters?
>> 
>> WHERE SDEPTHR.JOBNAME #bindEqual($val);
>> 
>> and then when you execute the query, update the parameter map with key:"val" and
value: "Test_*@#*"?
>> 
>> Robert
>> 
>> On May 16, 2011, at 5/163:35 PM , Laurent Marchal wrote:
>> 
>>> Hi,
>>> 
>>>    I am using a simple SQLTemplate select query but it fails because of special
charachters :
>>> 
>>> SELECT * FROM SDEPTHR  INNER JOIN THRESH ON SDEPTHR.DEPTHRID=THRESH.THRESHID
 WHERE SDEPTHR.JOBNAME = 'Test_*@\#*'
>>> 
>>> Error returned :
>>> [v.3.0.1 Aug 25 2010 19:58:47] Error parsing template 'SELECT * FROM SDEPTHR
 INNER JOIN THRESH ON SDEPTHR.DEPTHRID=THRESH.THRESHID  WHERE SDEPTHR.JOBNAME = 'Test_*@\#*''
: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 1,
column 115.  Encountered:<EOF>  after : ""
>>> 
>>> It looks like the '#*' is the problem but I can't find a way to properly escape
those characters<http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#stringliterals>.
I know using the SQLTemplate parameters would solve this problem but I can't do that.
>>> Is there a way to tell cayenne to not parse the query with velocity or to escape
properly the query ?
>>> 
>>> Thank you.
>>> Laurent.


Mime
View raw message