> -----Original Message----- > From: Max Rydahl Andersen [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 22, 2004 11:23 AM > To: Alexey Loubyansky; Hibernate development > Subject: Re: [Hibernate] new template-based hql functions > > On Wed, 22 Dec 2004 04:20:13 -0600, Alexey Loubyansky > <[EMAIL PROTECTED]> > wrote: > > > By spec it has two params. But you can nest function calls. > > > > Actually, as it is implemented, you can define a template like > > concat(?1, ?2, ?3, ?4, ?5). Pass just two arguments will result in, > > depending on the template, (?1 || ?2). > > so you could add concat(?1) and that would be supported ?
Right. > ..but again that is a no-op, and maybe we would rather > complain to hint the user might be doing something wrong.... concat(?1 || ?2) is parsed not as one argument but three, since there are three tokens, i.e. ?1, || and ?2. > ..but again again - if you build it up dynamically having > concat(?1) is nice to avoid special logic to remove the concat.... But what is the point? If I understand it right, currently, functions like concat are written directly to the resulting SQL as-is. So, this is dialect specific from the beginning. There is no portability and the statement is subject to change if you change the db. So, why not just define a portable syntax for some functions? Thanks. > > i'm +0 on it. Don't now. > > /max > > > > >> -----Original Message----- > >> From: [EMAIL PROTECTED] > >> [mailto:[EMAIL PROTECTED] On > Behalf Of Max > >> Rydahl Andersen > >> Sent: Wednesday, December 22, 2004 11:14 AM > >> To: Hibernate development > >> Subject: Re: [Hibernate] new template-based hql functions > >> > >> On Wed, 22 Dec 2004 03:46:03 -0600, Alexey Loubyansky > >> <[EMAIL PROTECTED]> > >> wrote: > >> > >> > package org.hibernate.test.hql; > >> > org.hibernate.test.hql.HQLTest > >> > public class HQLTest extends QueryTranslatorTestCase { > >> > public void testExpressionInFunction() throws Exception { > >> > assertTranslation( "from Animal an where > >> an.description = > >> > concat('fat'||'skinny')" ); > >> > > >> > concat is recognized as a template function and the > >> template is applied. > >> > The template is concat(?1, ?2) as defined in the EJBQL. Of > >> course, the > >> > test fails. > >> > > >> > Should we still support the old fat skinny one? > >> > >> Shouldn't concat allow CONCAT(str1,str2,...) or is that > too magically > >> ? ;) (that would support both cases)...or more simpler have two > >> templates: > >> > >> concat(?1) and concat(?2) even though the first one would > be a noop.. > >> > >> /max > >> > >> > > >> > ------------------------------------------------------- > >> > SF email is sponsored by - The IT Product Guide Read honest > >> & candid > >> > reviews on hundreds of IT Products from real users. > >> > Discover which products truly live up to the hype. Start > >> reading now. > >> > http://productguide.itmanagersjournal.com/ > >> > _______________________________________________ > >> > hibernate-devel mailing list > >> > hibernate-devel@lists.sourceforge.net > >> > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > >> > >> > >> > >> -- > >> Max Rydahl Andersen > >> callto://max.rydahl.andersen > >> > >> Hibernate > >> [EMAIL PROTECTED] > >> http://hibernate.org > >> > >> JBoss Inc > >> [EMAIL PROTECTED] > >> http://jboss.com > >> > >> > >> ------------------------------------------------------- > >> SF email is sponsored by - The IT Product Guide Read > honest & candid > >> reviews on hundreds of IT Products from real users. > >> Discover which products truly live up to the hype. Start > reading now. > >> http://productguide.itmanagersjournal.com/ > >> _______________________________________________ > >> hibernate-devel mailing list > >> hibernate-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/hibernate-devel > >> > > > > -- > Max Rydahl Andersen > callto://max.rydahl.andersen > > Hibernate > [EMAIL PROTECTED] > http://hibernate.org > > JBoss Inc > [EMAIL PROTECTED] > http://jboss.com > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel