[
https://issues.apache.org/jira/browse/DERBY-3946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647071#action_12647071
]
Rick Hillegas edited comment on DERBY-3946 at 3/9/10 3:54 PM:
--------------------------------------------------------------
Attaching derby-3946-01-aa-standaloneParser.diff and ASTParser.java. Note that
this patch has already been committed and is built into the 10.5 releases. To
test-drive ASTParser, you need to do the following:
A) Compile ASTParser
B) Run ASTParser. The program takes one argument, which is a query string which
you would like to parse. The program then retrieves the parsed query tree and
prints it out. For example:
java ASTParser "select a from t, s where t.a = s.a"
Note that this technique for using the parser standalone involves invoking
non-public APIs which are subject to change from release to release. Note,
however, that these APIs have remained stable since Derby was open-sourced.
The patch touched the following files. I checked in these changes after the
tests passed.
M
java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
M java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
Adds some accessors to the compiler's state variable so that query trees can be
stored and retrieved.
M java/engine/org/apache/derby/impl/sql/GenericStatement.java
Pokes the query tree into the state variable when the user sets the
StopAfterParsing tracepoint.
was (Author: rhillegas):
Attaching derby-3946-01-aa-standaloneParser.diff and ASTParser.java. To
test-drive these changes, you need to do the following:
A) Apply the patch to the Derby trunk and build Derby.
B) Compile ASTParser
C) Run ASTParser. The program takes one argument, which is a query string which
you would like to parse. The program then retrieves the parsed query tree and
prints it out. For example:
java ASTParser "select a from t, s where t.a = s.a"
Note that this technique for using the parser standalone involves invoking
non-public APIs which are subject to change from release to release. Note,
however, that these APIs have remained stable since Derby was open-sourced.
The patch touches the following files. I will run tests. I am inclined to check
in these changes if the tests pass.
M
java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
M java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
Adds some accessors to the compiler's state variable so that query trees can be
stored and retrieved.
M java/engine/org/apache/derby/impl/sql/GenericStatement.java
Pokes the query tree into the state variable when the user sets the
StopAfterParsing tracepoint.
> Provide support for using the Derby parser to generate Abstract Syntax Trees
> ----------------------------------------------------------------------------
>
> Key: DERBY-3946
> URL: https://issues.apache.org/jira/browse/DERBY-3946
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 10.5.1.1
> Reporter: Rick Hillegas
> Attachments: ASTParser.java, ASTParser.java, ASTParser.java,
> derby-3946-01-aa-standaloneParser.diff, TreeWalker.java, TreeWalker.java
>
>
> Users would like to be able to use the Derby parser to produce query trees
> without actually running the queries on Derby.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.