> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Max Rydahl Andersen > Sent: Wednesday, December 22, 2004 3:33 PM > To: Hibernate development > Subject: Re: [Hibernate] new template-based hql functions > > > > No, parsing is not a problem. This is parsed not by the > query parser > > but by the SQLFunctionTemplate class. > > ok - well maybe i'm stupid again since I can't see why it is > more inefficient... > (isn't ?1, ?2, ?3 equal to :1,:2,:3 which is again equal to > :a,:b,:c or even ?,?,?)
Numbers define indexes but string/characters don't. There is no difference between '?' and ':'. Using just '?' has one issue (see above) but maybe it's not an issue in practice. I have no strong objections against any approach. Tell me how you want it to be done or do it yourself ;) > ..the diff I can see is that instead of a Object[] rep it > will be Map rep, correct ? Sure, if you use names it implies using Map. But I should also remember the order of parameters as they appear in HQL function. Because, what parser reports is 'here is the next argument'. It doesn't say 'this is argument 'month''. Again, no big deal for me. The performance won't degrade. alex > > >> but again - it's mostly the for me "unneedded" extra > syntax i would > >> like to avoid... > > > > Ok. Thanks. > > And now thinking more - why ain't ? enough if you just need > to know the sequence ? > > All the ? will just end up in a Object[] anyway, right - or ? > > /max > > >> > >> /max > >> > >> > > >> >> -----Original Message----- > >> >> From: [EMAIL PROTECTED] > >> >> [mailto:[EMAIL PROTECTED] On > >> Behalf Of Max > >> >> Rydahl Andersen > >> >> Sent: Wednesday, December 22, 2004 1:23 PM > >> >> To: Hibernate development > >> >> Subject: Re: [Hibernate] new template-based hql functions > >> >> > >> >> On Wed, 22 Dec 2004 06:10:57 -0600, Alexey Loubyansky > >> >> <[EMAIL PROTECTED]> > >> >> wrote: > >> >> > >> >> Looks nice. > >> >> > >> >> Stupid question again from me - any reason why you use ?1 > >> syntax and > >> >> not just ? or :name here ? > >> >> (Just to keep the syntaxes for placeholders down at a minimum ,) > >> >> > >> >> /max > >> >> > >> >> > This is committed now. > >> >> > To define a new function template you create an instance of > >> >> > SQLFunctionTemplate which implements SQLFunction and > >> >> register it in a > >> >> > dialect as any other SQLFunction, e.g. > >> >> > > >> >> > registerFunction("locate", new > >> >> > SQLFunctionTemplate(Hibernate.INTEGER, "locate(?1, ?2, ?3)")); > >> >> > > >> >> > By the spec, this locate function might have 2 or 3 > >> parameters. So, > >> >> > you define 3 in the template but can pass just 2. > >> >> > > >> >> > If the template is not found for a specific dialect when > >> generating > >> >> > SQL, the function will appear in the generated SQL as it > >> appears in > >> >> > the EJB/H-QL statement. I.e. it is how it worked before. > >> >> > > >> >> >> -----Original Message----- > >> >> >> From: [EMAIL PROTECTED] > >> >> >> [mailto:[EMAIL PROTECTED] On > >> Behalf Of > >> >> >> Alexey Loubyansky > >> >> >> Sent: Wednesday, December 22, 2004 12:39 PM > >> >> >> To: Max Andersen; Hibernate development > >> >> >> Subject: RE: [Hibernate] new template-based hql functions > >> >> >> > >> >> >> > > concat(?1 || ?2) is parsed not as one argument but three, > >> >> >> > since there > >> >> >> > > are three tokens, i.e. ?1, || and ?2. > >> >> >> > > >> >> >> > oh - afraid of sounding stupid, but shouldn't that be > >> parsed as > >> >> >> > a > >> >> >> > functioncall(expression) ? > >> >> >> > where expression is (x op y) in this case ? > >> >> >> > >> >> >> Yes, sorry, of course, it is parsed like this. > >> >> >> I had a bug in creating an argument list. It works now. > >> >> >> > >> >> >> Thanks. > >> >> >> > >> >> >> > >> >> >> ------------------------------------------------------- > >> >> >> 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 > >> > > > > -- > 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 > ------------------------------------------------------- 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