Tabnine Logo
SqlDialect.quoteIdentifier
Code IndexAdd Tabnine to your IDE (free)

How to use
quoteIdentifier
method
in
org.apache.calcite.sql.SqlDialect

Best Java code snippets using org.apache.calcite.sql.SqlDialect.quoteIdentifier (Showing top 17 results out of 315)

origin: apache/kylin

public String convertSql(String orig) {
  // for jdbc source, convert quote from backtick to double quote
  String converted = orig.replaceAll("`", "\"");
  if (!configurer.skipHandleDefault()) {
    String escapedDefault = SqlDialect.CALCITE
        .quoteIdentifier(configurer.useUppercaseDefault() ? "DEFAULT" : "default");
    converted = converted.replaceAll("(?i)default\\.", escapedDefault + "."); // use Calcite dialect to cater to SqlParser
    converted = converted.replaceAll("\"(?i)default\"\\.", escapedDefault + ".");
  }
  if (!configurer.skipDefaultConvert()) {
    try {
      SqlNode sqlNode = SqlParser.create(converted).parseQuery();
      sqlNode = sqlNode.accept(sqlNodeConverter);
      converted = sqlWriter.format(sqlNode);
    } catch (Throwable e) {
      logger.error("Failed to default convert sql, will use the input: {}", orig, e);
    } finally {
      sqlWriter.reset();
    }
  }
  converted = configurer.fixAfterDefaultConvert(converted);
  return converted;
}
origin: apache/kylin

@Override
public void identifier(String name) {
  String convertName = name;
  if (configurer.isCaseSensitive()) {
    convertName = configurer.fixIdentifierCaseSensitve(name);
  }
  if (configurer.enableQuote()) {
    String quoted = getDialect().quoteIdentifier(convertName);
    print(quoted);
    setNeedWhitespace(true);
  } else {
    if (!configurer.skipHandleDefault() && convertName.trim().equalsIgnoreCase("default")) {
      String quoted = getDialect().quoteIdentifier(convertName);
      print(quoted);
      setNeedWhitespace(true);
    } else {
      super.identifier(convertName);
    }
  }
}
origin: org.apache.calcite/calcite-core

/**
 * Appends a compound identifier to this buffer, quoting accordingly.
 *
 * @param names Parts of a compound identifier
 * @return This builder
 */
public SqlBuilder identifier(List<String> names) {
 dialect.quoteIdentifier(buf, names);
 return this;
}
origin: Qihoo360/Quicksql

/**
 * Appends an identifier to this buffer, quoting accordingly.
 *
 * @param name Identifier
 * @return This builder
 */
public SqlBuilder identifier(String name) {
 dialect.quoteIdentifier(buf, name);
 return this;
}
origin: Qihoo360/Quicksql

/**
 * Appends a compound identifier to this buffer, quoting accordingly.
 *
 * @param names Parts of a compound identifier
 * @return This builder
 */
public SqlBuilder identifier(List<String> names) {
 dialect.quoteIdentifier(buf, names);
 return this;
}
origin: org.apache.calcite/calcite-core

/**
 * Appends an identifier to this buffer, quoting accordingly.
 *
 * @param name Identifier
 * @return This builder
 */
public SqlBuilder identifier(String name) {
 dialect.quoteIdentifier(buf, name);
 return this;
}
origin: Qihoo360/Quicksql

/**
 * Quotes a multi-part identifier.
 *
 * @param buf         Buffer
 * @param identifiers List of parts of the identifier to quote
 * @return The buffer
 */
public StringBuilder quoteIdentifier(
  StringBuilder buf,
  List<String> identifiers) {
 int i = 0;
 for (String identifier : identifiers) {
  if (i++ > 0) {
   buf.append('.');
  }
  quoteIdentifier(buf, identifier);
 }
 return buf;
}
origin: org.apache.calcite/calcite-core

/**
 * Quotes a multi-part identifier.
 *
 * @param buf         Buffer
 * @param identifiers List of parts of the identifier to quote
 * @return The buffer
 */
public StringBuilder quoteIdentifier(
  StringBuilder buf,
  List<String> identifiers) {
 int i = 0;
 for (String identifier : identifiers) {
  if (i++ > 0) {
   buf.append('.');
  }
  quoteIdentifier(buf, identifier);
 }
 return buf;
}
origin: Qihoo360/Quicksql

/**
 * Appends one or more identifiers to this buffer, quoting accordingly.
 *
 * @param names Varargs array of identifiers
 * @return This builder
 */
public SqlBuilder identifier(String... names) {
 dialect.quoteIdentifier(buf, UnmodifiableArrayList.of(names));
 return this;
}
origin: org.apache.calcite/calcite-core

/**
 * Appends one or more identifiers to this buffer, quoting accordingly.
 *
 * @param names Varargs array of identifiers
 * @return This builder
 */
public SqlBuilder identifier(String... names) {
 dialect.quoteIdentifier(buf, UnmodifiableArrayList.of(names));
 return this;
}
origin: org.apache.calcite/calcite-core

public void toSql(SqlWriter writer) {
 writer.dialect.quoteIdentifier(writer.buf, identifiers());
}
origin: Qihoo360/Quicksql

public void identifier(String name) {
 String qName = name;
 if (isQuoteAllIdentifiers()
   || dialect.identifierNeedsToBeQuoted(name)) {
  qName = dialect.quoteIdentifier(name);
 }
 maybeWhitespace(qName);
 pw.print(qName);
 charCount += qName.length();
 setNeedWhitespace(true);
}
origin: org.apache.calcite/calcite-core

public void identifier(String name) {
 String qName = name;
 if (isQuoteAllIdentifiers()
   || dialect.identifierNeedsToBeQuoted(name)) {
  qName = dialect.quoteIdentifier(name);
 }
 maybeWhitespace(qName);
 pw.print(qName);
 charCount += qName.length();
 setNeedWhitespace(true);
}
origin: Qihoo360/Quicksql

 dialect.quoteIdentifier(buf, column.identifiers());
 dialect.quoteIdentifier(groupBuf, column.identifiers());
 final String fieldName = uniqueColumnNames.get(i);
 columnNames.add(fieldName);
 if (!column.alias.equals(fieldName)) {
  buf.append(" AS ");
  dialect.quoteIdentifier(buf, fieldName);
    buf.append(", ");
   dialect.quoteIdentifier(buf, arg.identifiers());
  ++m;
 dialect.quoteIdentifier(buf, measureName);
 buf.append("\nJOIN ");
dialect.quoteIdentifier(buf, node.scan.getTable().getQualifiedName());
buf.append(" AS ");
dialect.quoteIdentifier(buf, node.alias);
if (node.parent != null) {
 buf.append(" ON ");
  dialect.quoteIdentifier(buf, left.identifiers());
  buf.append(" = ");
  final Column right = columns.get(node.startCol + pair.target);
  dialect.quoteIdentifier(buf, right.identifiers());
origin: org.apache.calcite/calcite-core

  dialect.quoteIdentifier(buf, column.alias);
  ++m;
 dialect.quoteIdentifier(buf, measureName);
 buf.append("\nJOIN ");
dialect.quoteIdentifier(buf, node.table.t.getQualifiedName());
buf.append(" AS ");
dialect.quoteIdentifier(buf, node.alias);
if (node instanceof LatticeChildNode) {
 final LatticeChildNode node1 = (LatticeChildNode) node;
origin: org.apache.kylin/kylin-datasource-sdk

public String convertSql(String orig) {
  // for jdbc source, convert quote from backtick to double quote
  String converted = orig.replaceAll("`", "\"");
  if (!configurer.skipHandleDefault()) {
    String escapedDefault = SqlDialect.CALCITE
        .quoteIdentifier(configurer.useUppercaseDefault() ? "DEFAULT" : "default");
    converted = converted.replaceAll("(?i)default\\.", escapedDefault + "."); // use Calcite dialect to cater to SqlParser
    converted = converted.replaceAll("\"(?i)default\"\\.", escapedDefault + ".");
  }
  if (!configurer.skipDefaultConvert()) {
    try {
      SqlNode sqlNode = SqlParser.create(converted).parseQuery();
      sqlNode = sqlNode.accept(sqlNodeConverter);
      converted = sqlWriter.format(sqlNode);
    } catch (Throwable e) {
      logger.error("Failed to default convert sql, will use the input: {}", orig, e);
    } finally {
      sqlWriter.reset();
    }
  }
  converted = configurer.fixAfterDefaultConvert(converted);
  return converted;
}
origin: org.apache.kylin/kylin-datasource-sdk

@Override
public void identifier(String name) {
  String convertName = name;
  if (configurer.isCaseSensitive()) {
    convertName = configurer.fixIdentifierCaseSensitve(name);
  }
  if (configurer.enableQuote()) {
    String quoted = getDialect().quoteIdentifier(convertName);
    print(quoted);
    setNeedWhitespace(true);
  } else {
    if (!configurer.skipHandleDefault() && convertName.trim().equalsIgnoreCase("default")) {
      String quoted = getDialect().quoteIdentifier(convertName);
      print(quoted);
      setNeedWhitespace(true);
    } else {
      super.identifier(convertName);
    }
  }
}
org.apache.calcite.sqlSqlDialectquoteIdentifier

Javadoc

Encloses an identifier in quotation marks appropriate for the current SQL dialect.

For example, quoteIdentifier("emp") yields a string containing "emp" in Oracle, and a string containing [emp] in Access.

Popular methods of SqlDialect

  • quoteStringLiteral
    Converts a string into a string literal. For example, can't run becomes 'can''t run'.
  • unparseCall
  • <init>
    Creates a SqlDialect.
  • supportsAggregateFunction
  • supportsCharSet
    Returns whether the dialect supports character set names as part of a data type, for instance VARCHA
  • allowsAs
  • containsNonAscii
    Returns whether the string contains any characters outside the comfortable 7-bit ASCII range (32 thr
  • defaultNullDirection
    Returns whether NULL values are sorted first or last, in this dialect, in an ORDER BY item of a give
  • emulateNullDirection
    Returns the SqlNode for emulating the null direction for the given field or null if no emulation ne
  • getCalendarPolicy
  • getCastSpec
  • getDatabaseProduct
    Returns the database this dialect belongs to, SqlDialect.DatabaseProduct#UNKNOWN if not known, never
  • getCastSpec,
  • getDatabaseProduct,
  • getNullCollation,
  • hasImplicitTableAlias,
  • identifierNeedsToBeQuoted,
  • quoteStringLiteralUnicode,
  • quoteTimestampLiteral,
  • rewriteSingleValueExpr,
  • supportsAliasedValues

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Collectors (java.util.stream)
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now