[
https://issues.apache.org/jira/browse/DERBY-4415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12767494#action_12767494
]
Rick Hillegas edited comment on DERBY-4415 at 10/19/09 7:56 PM:
----------------------------------------------------------------
Here's a sample script which pokes a custom AST printer into the compiler:
connect 'jdbc:derby:memory:dummy;create=true';
create table t( a int );
create procedure setInspector( visitorClassName varchar( 32672 ) )
language java
parameter style java
modifies sql data
external name 'ASTInspector.setInspector'
;
call setInspector( 'XmlASTPrinter' );
select * from t;
The custom printer writes the parsed, bound, and optimized trees as xml into
derbyAST.xml. You can then pull that printout into your favorite tool for
browsing xml. I use Firefox for this. Firefox lets me collapse and expands
elements in this printout. Since each node in an AST is printed as a separate
element, this is very handy for revealing the structure of a plan and for
hiding the details you are not interested in.
call setInspector( null );
was (Author: rhillegas):
Here's a sample script which pokes a custom AST printer into the compiler:
connect 'jdbc:derby:memory:dummy;create=true';
create table t( a int );
create procedure setInspector( visitorClassName varchar( 32672 ) )
language java
parameter style java
modifies sql data
external name 'ASTInspector.setInspector'
;
call setInspector( 'XmlASTPrinter' );
select * from t;
call setInspector( null );
> Make it easy to plug custom AST printers into the compiler
> ----------------------------------------------------------
>
> Key: DERBY-4415
> URL: https://issues.apache.org/jira/browse/DERBY-4415
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Reporter: Rick Hillegas
> Priority: Minor
> Attachments: ASTInspector.java,
> derby-4415-01-aa-customASTprinters.diff, XmlASTPrinter.java
>
>
> It would be nice to be able to tell the compiler to use user-written
> formatters for pretty-printing Derby's abstract syntax trees. For instance,
> it would be nice to be able to plug in the AST printers attached to
> DERBY-791, including the Eclipse-based tree grapher written by Kay Röpke.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.