org.apache.calcite.rex.RexBuilder.makePreciseStringLiteral()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.apache.calcite.rex.RexBuilder.makePreciseStringLiteral方法的一些代码示例,展示了RexBuilder.makePreciseStringLiteral的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RexBuilder.makePreciseStringLiteral方法的具体详情如下:
包路径:org.apache.calcite.rex.RexBuilder
类名称:RexBuilder
方法名:makePreciseStringLiteral

RexBuilder.makePreciseStringLiteral介绍

[英]Creates a character string literal with type CHAR and default charset and collation.
[中]创建类型为CHAR、默认字符集和排序规则的字符串文字。

代码示例

代码示例来源:origin: Qihoo360/Quicksql

/**
 * Creates a character string literal.
 */
public RexLiteral makeLiteral(String s) {
 assert s != null;
 return makePreciseStringLiteral(s);
}

代码示例来源:origin: org.apache.calcite/calcite-core

/**
 * Creates a character string literal.
 */
public RexLiteral makeLiteral(String s) {
 assert s != null;
 return makePreciseStringLiteral(s);
}

代码示例来源:origin: org.apache.calcite/calcite-core

final NlsString utf8 = new NlsString("foobar", "UTF8", SqlCollation.IMPLICIT);
RexNode literal = builder.makePreciseStringLiteral("foobar");
assertEquals("'foobar'", literal.toString());
literal = builder.makePreciseStringLiteral(
  new ByteString(new byte[] { 'f', 'o', 'o', 'b', 'a', 'r'}),
  "UTF8",
  SqlCollation.IMPLICIT);
assertEquals("_UTF8'foobar'", literal.toString());
literal = builder.makePreciseStringLiteral(
  new ByteString("\u82f1\u56fd".getBytes(StandardCharsets.UTF_8)),
  "UTF8",
assertEquals("_UTF8'\u82f1\u56fd'", literal.toString());
literal = builder.makePreciseStringLiteral(
  new ByteString("\u82f1".getBytes(StandardCharsets.UTF_8)),
  "UTF8",
assertEquals("_UTF8'\u82f1'", literal.toString());
try {
 literal = builder.makePreciseStringLiteral(
   new ByteString("\u82f1\u56fd".getBytes(StandardCharsets.UTF_8)),
   "GB2312",

相关文章

微信公众号

最新文章

更多