cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: A bug perhaps?
Date Tue, 26 Dec 2006 11:35:02 GMT
Confirmed - this is a bug caused by Velocity processing specifics -  
when a Velocity macro appears at the end of the line, the line break  
disappears from the processed query. I opened a bug report:

http://issues.apache.org/cayenne/browse/CAY-726

Andrus



On Dec 26, 2006, at 11:25 AM, Gary Jarrel wrote:

> Hi All!
>
> Just came across some interesting behavior while creating Raw Select
> Queries in the modeler.
>
> If my query looks like:
>
> SELECT #result('count(*)' 'int' 'RECORDCOUNT')
> FROM message JOIN user ON message.client_id = user.client_id
> WHERE message.inbound = #bind($inboundStatus)
> #if($userID)
>    AND user.client_id = #bind($userID)
> #end
>
> I get a SQLException as the new line character from the first to
> second line is ignored and the SQL in the log looks like:
>
> SELECT count(*) AS RECORDCOUNTFROM message JOIN user ON
> message.client_id = user.client_id
> WHERE message.inbound = ?    AND user.client_id = ?]
>
> However if I restructure the query in the modeler to:
>
> SELECT #result('count(*)' 'int' 'RECORDCOUNT') FROM message JOIN user
> ON message.client_id = user.client_id
> WHERE message.inbound = #bind($inboundStatus)
> #if($userID)
>    AND user.client_id = #bind($userID)
> #end
>
> i.e SELECT and FROM on the same line with a space before FROM, all  
> is well?
>
> Anyone else come across this?
>
> Cheers,
>
> garyj
>


Mime
View raw message