Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 94073 invoked from network); 9 Mar 2010 15:56:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Mar 2010 15:56:16 -0000 Received: (qmail 97849 invoked by uid 500); 9 Mar 2010 15:55:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 97817 invoked by uid 500); 9 Mar 2010 15:55:48 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 97810 invoked by uid 99); 9 Mar 2010 15:55:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Mar 2010 15:55:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Mar 2010 15:55:47 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 69E20234C4B5 for ; Tue, 9 Mar 2010 15:55:27 +0000 (UTC) Message-ID: <1024982165.156421268150127432.JavaMail.jira@brutus.apache.org> Date: Tue, 9 Mar 2010 15:55:27 +0000 (UTC) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Issue Comment Edited: (DERBY-3946) Provide support for using the Derby parser to generate Abstract Syntax Trees In-Reply-To: <1410120458.1226518064355.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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.