[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
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 @@
/** 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("[");