Re: Re: Derby-SQL: Syntax Tree generator?

2006-01-03 Thread Ashwin Jayaprakash

Rick, thanks for replying.

Perhaps you meant -Dderby.debug.DumpParseTree=true instead of -Dderby.debug.true=DumpParseTree? But I tried that too and it didn't work. But anyway, I looked into the GenericStatement code where the Tree was being printed. I realised that was what I wanted to avoid - using the Compiler Context, connecting to a Database instance etc.

I just wanted to parse the SQL offline.

Also , can Derby be run in a completely non-persistent mode like HSQL? I do not want persistence, just SQL operations on a few thousand rows in-memory (I know this should've been posted as a separate question, well..)

Thanks,
Ashwin.




On Tue, 03 Jan 2006 Rick Hillegas wrote :
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/[EMAIL PROTECTED]




















Re: Re: Derby-SQL: Syntax Tree generator?

2006-01-03 Thread Dag H. Wanvik

Hi Aswin,

 Ashwin == Ashwin Jayaprakash [EMAIL PROTECTED] wrote:

Ashwin Also , can Derby be run in a completely non-persistent mode
Ashwin like HSQL? I do not want persistence, just SQL operations on a
Ashwin few thousand rows in-memory (I know this should've been posted
Ashwin as a separate question, well..)

Have a look at the Derby property `derby.system.durability', cf. this
section in the Tuning manual:

http://db.apache.org/derby/docs/10.1/tuning/rtunproperdurability.html

You can set this to test to improve performance at the expense of
durability. 

Dag


Re: Derby-SQL: Syntax Tree generator?

2006-01-03 Thread Rick Hillegas

Hi Ashwin,

Some more responses follow.

Regards,
-Rick

Ashwin Jayaprakash wrote:


Rick, thanks for replying.

Perhaps you meant -Dderby.debug.DumpParseTree=true instead of  
-Dderby.debug.true=DumpParseTree? But I tried that too and it didn't 
work. But anyway, I looked into the GenericStatement code where the 
Tree was being printed. I realised that was what I wanted to avoid - 
using the Compiler Context, connecting to a Database instance etc.


I apologize. I forgot to mention that you have to run with the debug 
version of Derby. You need to build Derby with the following flags set 
in the ant.properties in your home directory:


sanity=true
debug=true

Detailed instructions for building Derby can be found at 
http://svn.apache.org/repos/asf/db/derby/code/trunk/BUILDING.txt.




I just wanted to parse the SQL offline.

Also , can Derby be run in a completely non-persistent mode like HSQL? 
I do not want persistence, just SQL operations on a few thousand rows 
in-memory (I know this should've been posted as a separate question, 
well..)



It looks like Dag has sent you advice on this topic.



Thanks,
Ashwin.




On Tue, 03 Jan 2006 Rick Hillegas wrote :
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/[EMAIL
 PROTECTED]















http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/[EMAIL PROTECTED]