-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Sql Parser in AST Form
PostPosted: Sat Jun 24, 2006 7:13 am 
Beginner
Beginner

Joined: Sat Jun 24, 2006 7:05 am
Posts: 20
Looking at Hibernate documentation I found something wich can be usefull for me in differente environment.
I noticed You have some classes wich translates HQL query to SQL query creating an Antlr compatible AST.
I need to know if there is some classes wich create an AST form for a generic Sql query.
It would be usefull for me in order to translate SQL statements form a SQL dialect to another with some transformation.
Tks
Tullio


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 24, 2006 7:24 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
I don't see what you wan to do. Maybe you want to use Hibernate dialects to be able to convert SQL queries designed for one DBMS for another ?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 25, 2006 10:02 am 
Beginner
Beginner

Joined: Sat Jun 24, 2006 7:05 am
Posts: 20
Yes, but I want also apply some transformations to the AST, if possibble.
Tks
Tullio


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 25, 2006 12:07 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
I don't think it is. In fact, what you want to do is to converting the sql produced for a dialect into another.

I'm not sure a 100% but I think dialect are "one-way" usable : you use it to create SQL, but you cannot find the dialect from the generated SQL...

So, IMO there's in fact interesting things gathered in the dialect package : what is supported or not and how to express general concepts into specific SQL, but I'd say you'll have to write the converters by yourself.

Maybe you should ask for a hibernate commiter to see this post to confirm it or not.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 26, 2006 3:23 am 
Beginner
Beginner

Joined: Sat Jun 24, 2006 7:05 am
Posts: 20
However there's a "native SQL" function in Hibernate.
The questio is : theese native Sql statements are parsedin AST form before execution ?
If Yes, where can I find the class wich produces that AST from of the native sql ?
Tks
Tullio


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 26, 2006 4:32 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Which part of the doc are you referencing to ? http://www.hibernate.org/hib_docs/v3/re ... rysql.html ?

Maybe org.hibernate.hql.ast.util.ASTUtil or org.hibernate.hql.ast.ASTQueryTranslatorFactory (http://www.docjar.com/docs/api/org/hibe ... TUtil.html) (http://www.docjar.com/docs/api/org/hibe ... ctory.html) ?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 26, 2006 9:31 am 
Beginner
Beginner

Joined: Sat Jun 24, 2006 7:05 am
Posts: 20
I was looking into the documentation You told me, however classes You indicated are, I belive, related to Hql to Sql conversion but I don't see any Sql to Hql or Sql to Sql or Sql to AST conversion class.
Tks
Tullio


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 28, 2006 3:33 am 
Beginner
Beginner

Joined: Sat Jun 24, 2006 7:05 am
Posts: 20
Repost


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 28, 2006 3:42 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
tullio0106 wrote:
I was looking into the documentation You told me, however classes You indicated are, I belive, related to Hql to Sql conversion but I don't see any Sql to Hql or Sql to Sql or Sql to AST conversion class.


Well, I don't know. Did you have a look in the packages ? That's what I've done. But as I already said, I don't think you will be able to find what you want... I'd say you'll only find maybe some interesting infos that you'll have to retrieve to code your classes yourself...

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.