Christian,

Thanks for the idea. Just tried it... new with any expr list, including
subqueries are parsed. The AST came out a little funny at first, but I fixed
that using a new 'CONSTRUCTOR' node type (first sub-node is the class,
subsequent nodes are the argument list).

input: ->select new Foo(count(bar)) from bar<-
AST  :   ( query ( select ( ( Foo ( count bar ) ) ) ( from bar ) )
 \-'query' [QUERY]
    +-'select' [LITERAL_select]
    |  \-'(' [CONSTRUCTOR]
    |     +-'Foo' [IDENT]
    |     \-'count' [LITERAL_count]
    |        \-'bar' [IDENT]
    \-'from' [LITERAL_from]
       \-'bar' [IDENT]

input: ->select new Foo(count(bar),(select count(*) from doofus d where
d.gob = 'fat' )) from bar<-
AST  :   ( query ( select ( ( Foo ( count bar ) ( ( ( select ( count * ) ) (
from doofus ( as d ) ) ( where ( = ( . d gob ) 'fat' ) ) ) ) ) ( from bar )
)
 \-'query' [QUERY]
    +-'select' [LITERAL_select]
    |  \-'(' [CONSTRUCTOR]
    |     +-'Foo' [IDENT]
    |     +-'count' [LITERAL_count]
    |     |  \-'bar' [IDENT]
    |     \-'(' [OPEN]
    |        +-'select' [LITERAL_select]
    |        |  \-'count' [LITERAL_count]
    |        |     \-'*' [STAR]
    |        +-'from' [LITERAL_from]
    |        |  +-'doofus' [IDENT]
    |        |  \-'as' [ALIAS]
    |        |     \-'d' [IDENT]
    |        \-'where' [LITERAL_where]
    |           \-'=' [EQ]
    |              +-'.' [DOT]
    |              |  +-'d' [IDENT]
    |              |  \-'gob' [IDENT]
    |              \-''fat'' [QUOTED_STRING]
    \-'from' [LITERAL_from]
       \-'bar' [IDENT]

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Christian Bauer
> Sent: Monday, November 17, 2003 8:17 AM
> To: hibernate list
> Subject: Re: [Hibernate] Re: AST parser for HQL
> 
> 
> On 18 Nov (00:05), Gavin King wrote:
> 
> > Does the parser handle:
> > 
> > * subselects (can't notice one anywhere)
> > * floating point and decimal literals
> >   (it doesn't need to parse them, just recognize them)
> 
> I'd also plan for "select new Foo(count(bar))".
> 
> > This is the "implicit group by" we discussed in Aarhus, where 
> > Hibernate
> > guesses what columns it needs to group by.
> 
> Ah yes. I've read some more about this and we are right, the 
> SQL "expert group" is wrong.
> 
> -- 
> Christian Bauer
> [EMAIL PROTECTED]
> 
> 
> -------------------------------------------------------
> This SF. Net email is sponsored by: GoToMyPC
> GoToMyPC is the fast, easy and secure way to access your 
> computer from any Web browser or wireless device. Click here 
> to Try it Free! 
> https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/
g22lp.tmpl
_______________________________________________
hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devele.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel




-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to