当前位置: 首页>>代码示例>>Java>>正文


Java Casing类代码示例

本文整理汇总了Java中org.apache.calcite.avatica.util.Casing的典型用法代码示例。如果您正苦于以下问题:Java Casing类的具体用法?Java Casing怎么用?Java Casing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Casing类属于org.apache.calcite.avatica.util包,在下文中一共展示了Casing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getParser

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public Parser getParser(String sql, Properties info)
    throws SQLException {
  SqlParser parser = SqlParser.create(sql,
      SqlParser.configBuilder()
          .setQuotedCasing(Casing.UNCHANGED)
          .setUnquotedCasing(Casing.UNCHANGED)
          .setQuoting(Quoting.DOUBLE_QUOTE)
          .setParserFactory(QuarkParserImpl.FACTORY)
          .build());
  SqlNode sqlNode;
  try {
    sqlNode = parser.parseStmt();
  } catch (SqlParseException e) {
    throw new RuntimeException(
        "parse failed: " + e.getMessage(), e);
  }
  if (sqlNode.getKind().equals(SqlKind.OTHER_DDL)) {
    return new DDLParser();
  } else  {
    return getSqlQueryParser(info);
  }
}
 
开发者ID:qubole,项目名称:quark,代码行数:23,代码来源:ParserFactory.java

示例2: buildPlanner

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
private Planner buildPlanner(QueryContext context) {
  final List<RelTraitDef> traitDefs = new ArrayList<RelTraitDef>();
  traitDefs.add(ConventionTraitDef.INSTANCE);
  traitDefs.add(RelCollationTraitDef.INSTANCE);
  final ChainedSqlOperatorTable opTab =
      new ChainedSqlOperatorTable(
          ImmutableList.of(SqlStdOperatorTable.instance(),
              HiveSqlOperatorTable.instance(), catalogReader));
  FrameworkConfig config = Frameworks.newConfigBuilder() //
      .parserConfig(SqlParser.configBuilder()
          .setQuotedCasing(Casing.UNCHANGED)
          .setUnquotedCasing(Casing.TO_UPPER)
          .setQuoting(Quoting.DOUBLE_QUOTE)
          .build()) //
      .defaultSchema(context.getDefaultSchema()) //
      .operatorTable(opTab) //
      .traitDefs(traitDefs) //
      .convertletTable(StandardConvertletTable.INSTANCE)//
      .programs(getPrograms()) //
      .typeSystem(RelDataTypeSystem.DEFAULT) //
      .build();
  return Frameworks.getPlanner(config);
}
 
开发者ID:qubole,项目名称:quark,代码行数:24,代码来源:SqlWorker.java

示例3: strip

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
/**
 * Unquotes a quoted string, using different quotes for beginning and end.
 */
public static String strip(String s, String startQuote, String endQuote,
    String escape, Casing casing) {
  if (startQuote != null) {
    assert endQuote != null;
    assert startQuote.length() == 1;
    assert endQuote.length() == 1;
    assert escape != null;
    assert s.startsWith(startQuote) && s.endsWith(endQuote) : s;
    s = s.substring(1, s.length() - 1).replace(escape, endQuote);
  }
  switch (casing) {
  case TO_UPPER:
    return s.toUpperCase(Locale.ROOT);
  case TO_LOWER:
    return s.toLowerCase(Locale.ROOT);
  default:
    return s;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:SqlParserUtil.java

示例4: testCaseInsensitiveTableAliasInGroupBy

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
/** Test case for
 * <a href="https://issues.apache.org/jira/browse/CALCITE-1305">[CALCITE-1305]
 * Case-insensitive table aliases and GROUP BY</a>. */
@Test public void testCaseInsensitiveTableAliasInGroupBy() {
  final SqlTester tester1 = tester
      .withCaseSensitive(false)
      .withUnquotedCasing(Casing.UNCHANGED);
  tester1.checkQuery("select deptno, count(*) from EMP AS emp\n"
      + "group by eMp.deptno");
  tester1.checkQuery("select deptno, count(*) from EMP AS EMP\n"
      + "group by eMp.deptno");
  tester1.checkQuery("select deptno, count(*) from EMP\n"
      + "group by eMp.deptno");
  tester1.checkQuery("select * from EMP where exists (\n"
      + "  select 1 from dept\n"
      + "  group by eMp.deptno)");
  tester1.checkQuery("select deptno, count(*) from EMP group by DEPTNO");
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:SqlValidatorTest.java

示例5: getIdentifierCasing

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public static IdentifierCasing getIdentifierCasing(Casing casing, boolean caseSensitive) {
  switch(casing) {
  case TO_LOWER:
    return IdentifierCasing.IC_STORES_LOWER;

  case TO_UPPER:
    return IdentifierCasing.IC_STORES_UPPER;

  case UNCHANGED:
    return caseSensitive ? IdentifierCasing.IC_SUPPORTS_MIXED : IdentifierCasing.IC_STORES_MIXED;

  default:
    throw new AssertionError("Unknown casing:" + casing);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:ServerMetaProvider.java

示例6: parseSql

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private T parseSql(String sql) throws SQLException {
    logger.debug("[parseSql]");
    try {
        SqlParser sqlParser = SqlParser.create(sql, SqlParser.configBuilder()
                .setParserFactory(SqlParserImpl.FACTORY)
                .setUnquotedCasing(Casing.TO_LOWER)
                .setQuoting(Quoting.DOUBLE_QUOTE)
                .build());
        return (T) sqlParser.parseStmt();
    } catch (SqlParseException exc) {
        throw new SQLException("Could not parse sql: " + sql, exc);
    }
}
 
开发者ID:axibase,项目名称:atsd-jdbc,代码行数:15,代码来源:AtsdSqlConverter.java

示例7: parseString

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
/**
 * Converts the contents of an sql quoted string literal into the
 * corresponding Java string representation (removing leading and trailing
 * quotes and unescaping internal doubled quotes).
 */
public static String parseString(String s) {
  int i = s.indexOf("'"); // start of body
  if (i > 0) {
    s = s.substring(i);
  }
  return strip(s, "'", "'", "''", Casing.UNCHANGED);
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlParserUtil.java

示例8: ConfigImpl

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
private ConfigImpl(int identifierMaxLength, Casing quotedCasing,
    Casing unquotedCasing, Quoting quoting, boolean caseSensitive,
    SqlConformance conformance, SqlParserImplFactory parserFactory) {
  this.identifierMaxLength = identifierMaxLength;
  this.caseSensitive = caseSensitive;
  this.conformance = Preconditions.checkNotNull(conformance);
  this.quotedCasing = Preconditions.checkNotNull(quotedCasing);
  this.unquotedCasing = Preconditions.checkNotNull(unquotedCasing);
  this.quoting = Preconditions.checkNotNull(quoting);
  this.parserFactory = Preconditions.checkNotNull(parserFactory);
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:SqlParser.java

示例9: createParser

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public SqlParser createParser(SqlTestFactory factory, String sql) {
  return SqlParser.create(sql,
      SqlParser.configBuilder()
          .setQuoting((Quoting) factory.get("quoting"))
          .setUnquotedCasing((Casing) factory.get("unquotedCasing"))
          .setQuotedCasing((Casing) factory.get("quotedCasing"))
          .setConformance((SqlConformance) factory.get("conformance"))
          .build());
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:DefaultSqlTestFactory.java

示例10: unquotedCasing

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
private Casing unquotedCasing() {
  return UNQUOTED_CASING.getEnum(getProperties(), Casing.class);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:4,代码来源:AvaticaDatabaseMetaData.java

示例11: quotedCasing

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
private Casing quotedCasing() {
  return QUOTED_CASING.getEnum(getProperties(), Casing.class);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:4,代码来源:AvaticaDatabaseMetaData.java

示例12: storesMixedCaseIdentifiers

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public boolean storesMixedCaseIdentifiers() throws SQLException {
  return !caseSensitive() && unquotedCasing() == Casing.UNCHANGED;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:4,代码来源:AvaticaDatabaseMetaData.java

示例13: supportsMixedCaseIdentifiers

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public boolean supportsMixedCaseIdentifiers() throws SQLException {
  return caseSensitive() && unquotedCasing() == Casing.UNCHANGED;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:4,代码来源:AvaticaDatabaseMetaData.java

示例14: storesUpperCaseIdentifiers

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public boolean storesUpperCaseIdentifiers() throws SQLException {
  return unquotedCasing() == Casing.TO_UPPER;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:4,代码来源:AvaticaDatabaseMetaData.java

示例15: storesLowerCaseIdentifiers

import org.apache.calcite.avatica.util.Casing; //导入依赖的package包/类
public boolean storesLowerCaseIdentifiers() throws SQLException {
  return unquotedCasing() == Casing.TO_LOWER;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:4,代码来源:AvaticaDatabaseMetaData.java


注:本文中的org.apache.calcite.avatica.util.Casing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。