You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Ashwin Jayaprakash <as...@rediffmail.com> on 2005/12/26 13:42:57 UTC

Derby-SQL: Syntax Tree generator?

Hi,
Does anybody know if there is a way to parse and view the AST for an SQL Query in Derby? I looked at the sqlparser.jj in the source code, but couldn't find a way to start it and parse a query without hacking into all the code.

Some thing like this one: http://www.experlog.com/gibello/zql/ ?

I am especially interested in extending the SQL grammar a little bit by adding a few keywords and re-writing some queries issued by the user. So,  some kind of a Visitor-pattern would be nice.

Thanks,
Ashwin (www.JavaForU.com).













Re: Derby-SQL: Syntax Tree generator?

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Ashwin,

I don't know whether anyone got back to you on this topic. I hope that 
this addresses your question.

The DumpParseTree tracepoint causes Derby to print the ASTs to 
derby.log. You can set this tracepoint when Derby starts up. Here for 
instance is how you would do it if you were running Derby embedded under 
the ij tool:

java -cp $CLASSPATH -Dderby.debug.true=DumpParseTree 
-Dderby.stream.error.logSeverityLevel=0 org.apache.derby.tools.ij  z.sql

Regards,
-Rick

Ashwin Jayaprakash wrote:

> Hi,
> Does anybody know if there is a way to parse and view the AST for an 
> SQL Query in Derby? I looked at the sqlparser.jj in the source code, 
> but couldn't find a way to start it and parse a query without hacking 
> into all the code.
>
> Some thing like this one: http://www.experlog.com/gibello/zql/ ?
>
> I am especially interested in extending the SQL grammar a little bit 
> by adding a few keywords and re-writing some queries issued by the 
> user. So,  some kind of a Visitor-pattern would be nice.
>
> Thanks,
> Ashwin (www.JavaForU.com).
>
>
>
>
>
>
>
>
>
>
>
>
> <http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3> 




Re: Derby-SQL: Syntax Tree generator?

Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Ashwin,

I don't know whether anyone got back to you on this topic. I hope that 
this addresses your question.

The DumpParseTree tracepoint causes Derby to print the ASTs to 
derby.log. You can set this tracepoint when Derby starts up. Here for 
instance is how you would do it if you were running Derby embedded under 
the ij tool:

java -cp $CLASSPATH -Dderby.debug.true=DumpParseTree 
-Dderby.stream.error.logSeverityLevel=0 org.apache.derby.tools.ij  z.sql

Regards,
-Rick

Ashwin Jayaprakash wrote:

> Hi,
> Does anybody know if there is a way to parse and view the AST for an 
> SQL Query in Derby? I looked at the sqlparser.jj in the source code, 
> but couldn't find a way to start it and parse a query without hacking 
> into all the code.
>
> Some thing like this one: http://www.experlog.com/gibello/zql/ ?
>
> I am especially interested in extending the SQL grammar a little bit 
> by adding a few keywords and re-writing some queries issued by the 
> user. So,  some kind of a Visitor-pattern would be nice.
>
> Thanks,
> Ashwin (www.JavaForU.com).
>
>
>
>
>
>
>
>
>
>
>
>
> <http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3>