I should be able to start working on an SQL producing examples in the next few days. I will take a look at net.sf.hibernate.persister.Queryable, and start a 'tree walker' grammar to round out a typical ANLR source translator in the typical 'three phase' ANTLR fasion (lexer->parser->tree parser).

Great ;)


If i remember the terminology correctly we will get a in-memory generated AST tree,
right ? And if we wanted we could manipulate that tree before the tree parser
generates the correct SQL, right ? (this would just be so cool to use for crazy stuff 
;)

Will be interesting to see how that stuff will perform compared to Gavins "top-of-his-head" parser ;)

/max


Here are some questions I had:

* Can this be done by just invoking the methods in the Hibernate JAR for
now, or do I need to build Hibernate?  Either way, which version of the
Hibernate API should I use?

* How do I:
        - Load and read Hibernate configurations?
        - Read information about 'dialects'?
        - Invoke SQL generating APIs?

* Should I add SQL-99 functions to the grammar?

Others have mentioned adding SQL-99 functions to the grammar and using them
to portably translate into the proper dialect. Since some of the SQL-99
functions have their own (IMHO, weird and unnecessary) syntax, they must be
added to the grammar.  For example:
        concatentate : "CONCATENATE" '(' expression ( '||' expression )* ')'
;

BTW, I've seen much more 'inelegant' hand written parsers before (written in
FORTRAN and assembly), your's isn't too bad at all.



-----Original Message-----
From: Gavin King [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 3:16 AM


OK, looks really great. So, now that we have a really nice grammar for HQL, whats the next step?

Well, lets get it to spit out some SQL, I suppose. I think the first step is to get it to translate:

from Foo foo where foo.id = 1

to SQL, given a mock instance of net.sf.hibernate.persister.Queryable.

Joshua, I know little about building proper compilers (I know a very little about parser compilers, but thats all) and it is universally agreed that my only previous attempt at it (net.sf.hibernate.hql) is ..... inelegant ..... so it would be fantastic if you could get me as far as showing me a proper design pattern for this. It would be fantastic if you could implement the above for me, to demonstrate what a proper translator looks like - that way I can pick up the other side of things (spitting out SQL) and integrate into Hibernate.

I'd like to really keep moving with this - its really good and we need it....

Thanks

Gavin

P.S. "addative" is spelled "additive" ;)

Joshua Davis wrote:


I've checked my code into my own CVS repository on Source Forge, in
case anyone wants to have a look. Cleaned things up a bit,

the tests


should run anyway. The build depends on: ANT, ANTLR, and JUnit

[EMAIL PROTECTED]:/cvsroot/yajul Module=hql

Web view: http://cvs.sourceforge.net/viewcvs.py/yajul/hql

Check it out. (pun intended... sorry!)



-- Gavin King JBoss Group +61 410534454 http://hibernate.org






------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel



------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to