David,

Thanks for the new examples. I will get to those after I finish with the
examples in the Hibernate HQL documentation.

Just to be clear, this is what I will add:

(1) Constructor calls with multiple arguments:  
>      select new net.sf.hibernate.test.S(s.count, s.address) 
> from s in class Simple

Note that this implies (5) Function calls with multiple arguments.

(2) Functions with no arguments:
> select s.name, sysdate, trunc(s.pay), round(s.pay) from s in 
> class Simple

I think the grammar should handle this already, as 'identifier' is a valid
select element.  Interpreting this as a function call will require a list of
function names  that can be used this way, which will be dialect dependent
of course.  This might add significant complexity to the parser, so I would
recommend that any dialect dependent syntax should be analyzed later on.

(3) The 'in class' clause:
> select s.name, sysdate, trunc(s.pay), round(s.pay) from s in 
> class Simple

Didn't see this construct yet.

(4) Nested function calls:
> select abs(round(s.pay)) from s in class Simple
> select trunc(round(sysdate)) from s in class Simple

(5) Functions with multiple arguments:
> select round(s.pay, 2) from s in class Simple

Oops!  Yeah, forgot about that.  You'll probably need this one. :)

(6) "the usual literal types and operators in the select clause"

I think I have implemented most of them.  I'll post the grammar when I'm a
little further along (it's ugly, bordering on fugly).

Hibernate developers,

-- Grammar problem #1: The 'from Order order where' examples --

Also, notice that I changed 'order' to 'ord' in many of the HQL examples in
the hibernate documentation.  This is because 'order' is a keyword, and the
statement:

        "from Order order where maxindex(order.items) > 100"

implies a *highly* ambiguous grammar (i.e. even more ambiguous than simply
allowing keywords as identifiers).  I *was* able to add a 'retry as
identifier' trick to the parser, but I was not able to get the parser to
realize the second occurrence of "order" is *not* the first part of an
"order by" clause.  I probably could get it to do this via some nasty
trickery, but I'd rather not.  The grammar will be much more extensible that
way.  So, this example has been changed to:

        "from Order ord where maxindex(ord.items) > 100"

in order to keep the parser simple.  Does this work, or do I have to go nuts
trying to get "from Order order where..." to work?

-- Grammar problem #2: The 'current date' problem --

I am not familiar with the 'current date' construct in this example:
        "from Calendar cal where cal.holidays.maxElement > current date"

Is 'current' a function?  If so, is 'date' the argument? Is this ORACLE
specific?

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of David Channon
> Sent: Sunday, November 16, 2003 9:09 AM
> To: Gavin King; Joshua Davis
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Hibernate] Re: AST parser for HQL
> 
> 
> Great work. This will make further enhancements to the Select 
> clause much easier. Here are a few more queries from the test 
> package that I use to test some of the more recent (and not 
> so well documented) changes to the select clause, eg, dialect 
> functions.
> 
> This one is not recent but affects the parser somewhat and 
> was not in your test suite.
>      select new net.sf.hibernate.test.S(s.count, s.address) 
> from s in class Simple
> 
> These a few tests for delects functions. From the tests it 
> would look like it would work as it stands although problem 
> maybe with some functions that have no arguments, for 
> example,those that have no parenthesis, eg, Oracle dialect
> 
> select s.name, sysdate, trunc(s.pay), round(s.pay) from s in 
> class Simple
> 
> Just for the record, Nested examples.
> 
> select abs(round(s.pay)) from s in class Simple
> select trunc(round(sysdate)) from s in class Simple
> 
> The current parser cannot do it at the moment (it is a pain 
> in current form) but multiple arguments comma separated is 
> easy for you to add, so we then hook into it,
> 
> select round(s.pay, 2) from s in class Simple
> 
> being very greedy it would be also real nice to include the 
> usual literal types and operators in the select clause. These 
> we also cannot do at the moment.
> 
> I do assume that this will get integrated in the 2.2 series 
> as it is fairly major surgery to hook this into the backend. 
> Look forward to it.
> 
> --David.
> 
> 
> ----- Original Message ----- 
> From: "Gavin King" <[EMAIL PROTECTED]>
> To: "Joshua Davis" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Sunday, November 16, 2003 1:50 PM
> Subject: [Hibernate] Re: AST parser for HQL
> 
> 
> > Fantastic! I presume that you meant to send this to 
> hibernate-devel, 
> > not hibernate-devel-admin, so I'm forwarding to the list....
> >
> > You are using ANTLR, right? This is good. I think its better than 
> > JavaCC from my small amount of contact with each.
> >
> >
> > Joshua Davis wrote:
> >
> > > Hibernate programmers,
> > >
> > > I'm just about done with a working version of an HQL parser that 
> > > produces ASTs.  It parses most of the examples now, 
> except for the 
> > > ones where keywords are identifiers and identifiers are keywords 
> > > simultaneously ;).  Anyone interested in reviewing it?  
> Some example 
> > > output is enclosed.
> > >
> > > Josh
> > >
> > >
> > > 
> --------------------------------------------------------------------
> > > ----
> [[CUT TESTS]]
> 
> 
> 
> -------------------------------------------------------
> 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




-------------------------------------------------------
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