} else { boolean includeCharset = (nlsString.getCharsetName() != null) && !nlsString.getCharsetName().equals( SaffronProperties.INSTANCE.defaultCharset().get()); pw.print(nlsString.asSql(includeCharset, false));
} else { boolean includeCharset = (nlsString.getCharsetName() != null) && !nlsString.getCharsetName().equals( SaffronProperties.INSTANCE.defaultCharset().get()); pw.print(nlsString.asSql(includeCharset, false));
ns.getCharsetName(), ns.getCollation()); return new SqlCharStringLiteral(ns, getParserPosition());
ns.getCharsetName(), ns.getCollation()); return new SqlCharStringLiteral(ns, getParserPosition());
/** Rewrite the parse tree as SELECT ... FROM INFORMATION_SCHEMA.SCHEMATA ... */ @Override public SqlNode rewrite(SqlNode sqlNode) throws ForemanSetupException { SqlShowSchemas node = unwrap(sqlNode, SqlShowSchemas.class); List<SqlNode> selectList = Collections.singletonList(new SqlIdentifier(SCHS_COL_SCHEMA_NAME, SqlParserPos.ZERO)); SqlNode fromClause = new SqlIdentifier(Arrays.asList(IS_SCHEMA_NAME, InfoSchemaTableType.SCHEMATA.name()), SqlParserPos.ZERO); SqlNode where = null; SqlNode likePattern = node.getLikePattern(); if (likePattern != null) { SqlNode column = new SqlIdentifier(SCHS_COL_SCHEMA_NAME, SqlParserPos.ZERO); // schema names are case insensitive, wrap column in lower function, pattern to lower case if (likePattern instanceof SqlCharStringLiteral) { NlsString conditionString = ((SqlCharStringLiteral) likePattern).getNlsString(); likePattern = SqlCharStringLiteral.createCharString( conditionString.getValue().toLowerCase(), conditionString.getCharsetName(), likePattern.getParserPosition()); column = SqlStdOperatorTable.LOWER.createCall(SqlParserPos.ZERO, column); } where = DrillParserUtil.createCondition(column, SqlStdOperatorTable.LIKE, likePattern); } else if (node.getWhereClause() != null) { where = node.getWhereClause(); } return new SqlSelect(SqlParserPos.ZERO, null, new SqlNodeList(selectList, SqlParserPos.ZERO), fromClause, where, null, null, null, null, null, null); } }
new NlsString( Spaces.padRight(unpadded.getValue(), type.getPrecision()), unpadded.getCharsetName(), unpadded.getCollation()));
new NlsString( Spaces.padRight(unpadded.getValue(), type.getPrecision()), unpadded.getCharsetName(), unpadded.getCollation()));
new NlsString( Spaces.padRight(unpadded.getValue(), type.getPrecision()), unpadded.getCharsetName(), unpadded.getCollation()));
new NlsString( Spaces.padRight(unpadded.getValue(), type.getPrecision()), unpadded.getCharsetName(), unpadded.getCollation()));
columnQualifier = SqlCharStringLiteral.createCharString( conditionString.getValue().toLowerCase(), conditionString.getCharsetName(), columnQualifier.getParserPosition()); column = SqlStdOperatorTable.LOWER.createCall(SqlParserPos.ZERO, column);
likePattern = SqlCharStringLiteral.createCharString( conditionString.getValue().toLowerCase(), conditionString.getCharsetName(), likePattern.getParserPosition()); column = SqlStdOperatorTable.LOWER.createCall(SqlParserPos.ZERO, column);