calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [15/18] incubator-calcite git commit: [CALCITE-851] Add original SQL string as a field in the parser
Date Wed, 02 Sep 2015 00:09:51 GMT
[CALCITE-851] Add original SQL string as a field in the parser


Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/39487512
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/39487512
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/39487512

Branch: refs/heads/master
Commit: 39487512e04cc89ae4f0e6909bf91c552f933659
Parents: 5a39706
Author: Julian Hyde <jhyde@apache.org>
Authored: Thu Aug 20 23:53:44 2015 -0700
Committer: Julian Hyde <jhyde@apache.org>
Committed: Tue Sep 1 16:17:16 2015 -0700

----------------------------------------------------------------------
 .../calcite/sql/parser/SqlAbstractParserImpl.java   | 16 ++++++++++++++++
 .../org/apache/calcite/sql/parser/SqlParser.java    |  1 +
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/39487512/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java b/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
index 6876447..bef5da7 100644
--- a/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
+++ b/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
@@ -327,6 +327,8 @@ public abstract class SqlAbstractParserImpl {
 
   protected int nDynamicParams;
 
+  protected String originalSql;
+
   //~ Methods ----------------------------------------------------------------
 
   /**
@@ -442,6 +444,20 @@ public abstract class SqlAbstractParserImpl {
   public abstract void setIdentifierMaxLength(int identifierMaxLength);
 
   /**
+   * Sets the SQL text that is being parsed.
+   */
+  public void setOriginalSql(String originalSql) {
+    this.originalSql = originalSql;
+  }
+
+  /**
+   * Returns the SQL text.
+   */
+  public String getOriginalSql() {
+    return originalSql;
+  }
+
+  /**
    * Change parser state.
    *
    * @param stateName new state.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/39487512/core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java b/core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java
index 1cf71fa..4c14395 100644
--- a/core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java
+++ b/core/src/main/java/org/apache/calcite/sql/parser/SqlParser.java
@@ -42,6 +42,7 @@ public class SqlParser {
       Config config) {
     this.originalInput = s;
     this.parser = parser;
+    parser.setOriginalSql(s);
     parser.setTabSize(1);
     parser.setQuotedCasing(config.quotedCasing());
     parser.setUnquotedCasing(config.unquotedCasing());


Mime
View raw message