You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2021/09/17 21:42:19 UTC

[calcite-avatica] branch master updated: [CALCITE-4767] Add Quoting.BACK_TICK_BACKSLASH (Jack Scott)

This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite-avatica.git


The following commit(s) were added to refs/heads/master by this push:
     new 0574db6  [CALCITE-4767] Add Quoting.BACK_TICK_BACKSLASH (Jack Scott)
0574db6 is described below

commit 0574db65ad08e8682277885a86cf3fbba76a1d21
Author: Jack Scott <ja...@google.com>
AuthorDate: Wed Sep 15 12:28:14 2021 -0700

    [CALCITE-4767] Add Quoting.BACK_TICK_BACKSLASH (Jack Scott)
    
    BACK_TICK_BACKSLASH is added to support Google BigQuery's
    identifier syntax.
    
    We also add SINGLE_QUOTE and SINGLE_QUOTE_BACKSLASH, which
    are not used by any known dialect, for possible future use.
    
    Close apache/calcite-avatica#153
---
 .../org/apache/calcite/avatica/util/Quoting.java   | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java b/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java
index 855e4a6..c9789ee 100644
--- a/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java
+++ b/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java
@@ -18,12 +18,30 @@ package org.apache.calcite.avatica.util;
 
 /** Syntax for quoting identifiers in SQL statements. */
 public enum Quoting {
-  /** Quote identifiers in double-quotes. For example, {@code "my id"}. */
+  /** Quote identifiers in double-quotes, and use double-quote to escape
+   * double-quotes. For example, {@code "my ""id"""}. */
   DOUBLE_QUOTE("\""),
 
-  /** Quote identifiers in back-quotes. For example, {@code `my id`}. */
+  /** Quote identifiers in double-quotes, and use backslash to escape
+   * double-quotes. For example, {@code "my \"id\""}. */
+  DOUBLE_QUOTE_BACKSLASH("\""),
+
+  /** Quote identifiers in single-quotes, and use single-quotes to escape
+   * single-quotes. For example, {@code 'my ''id'''}. */
+  SINGLE_QUOTE("`"),
+
+  /** Quote identifiers in single-quotes, and use backslash to escape
+   * single-quotes. For example, {@code 'my \'id\''}. */
+  SINGLE_QUOTE_BACKSLASH("`"),
+
+  /** Quote identifiers in back-quotes, and use back-quotes to escape
+   * back-quotes. For example, {@code `my ``id```}. */
   BACK_TICK("`"),
 
+  /** Quote identifiers in back-quotes, and use backslash to escape
+   * back-quotes. For example, {@code `my \`id\``}. */
+  BACK_TICK_BACKSLASH("`"),
+
   /** Quote identifiers in brackets. For example, {@code [my id]}. */
   BRACKET("[");