Tabnine Logo
SqlUtils.isKeyword
Code IndexAdd Tabnine to your IDE (free)

How to use
isKeyword
method
in
com.dremio.common.utils.SqlUtils

Best Java code snippets using com.dremio.common.utils.SqlUtils.isKeyword (Showing top 3 results out of 315)

origin: dremio/dremio-oss

@Test
public void testIsKeyword() {
 assertTrue(SqlUtils.isKeyword("USER"));
 assertTrue(SqlUtils.isKeyword("FiLeS"));
 assertFalse(SqlUtils.isKeyword("myUSER"));
}
origin: dremio/dremio-oss

@Override
public String visit(ExpColumnReference col) throws Exception {
 String tableAlias = col.getTable();
 if (tableAlias == null && isKeyword(col.getName())) {
  tableAlias = tableName;
 }
 if (tableAlias == null) {
  return quoteIdentifier(col.getName());
 } else {
  return format("%s.%s", quoteIdentifier(tableAlias), quoteIdentifier(col.getName()));
 }
}
origin: dremio/dremio-oss

/**
 * quote the identifier if it is a:
 *  - doesn't start with a character,
 *  - contains non-alphanumeric characters or
 *  - is a reserved keyword
 * @param id
 * @return
 */
public static String quoteIdentifier(final String id) {
 if (id.isEmpty()) {
  return id;
 }
 if (isKeyword(id)) {
  return quoteString(id);
 }
 if (Character.isAlphabetic(id.charAt(0)) && ALPHANUM_MATCHER.matchesAllOf(id)) {
  return id;
 }
 // Special case
 if (NEWLINE_MATCHER.matchesAnyOf(id)) {
  return quoteUnicodeString(id);
 }
 return quoteString(id);
}
com.dremio.common.utilsSqlUtilsisKeyword

Javadoc

Is the given id a reserved keyword?

Popular methods of SqlUtils

  • quoteIdentifier
    quote the identifier if it is a: - doesn't start with a character, - contains non-alphanumeric chara
  • parseSchemaPath
    Parse the schema path into a list of schema entries.
  • quotedCompound
  • stringLiteral
    Convert given string value as string literal in SQL.
  • quoteString
  • quoteUnicodeString

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • getContentResolver (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text plugins
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