Exemplo n.º 1
0
    @Override
    protected Type visitLikePredicate(LikePredicate node, AnalysisContext context) {
      coerceType(context, node.getValue(), VARCHAR, "Left side of LIKE expression");
      coerceType(context, node.getPattern(), VARCHAR, "Pattern for LIKE expression");
      if (node.getEscape() != null) {
        coerceType(context, node.getEscape(), VARCHAR, "Escape for LIKE expression");
      }

      expressionTypes.put(node, BOOLEAN);
      return BOOLEAN;
    }
Exemplo n.º 2
0
    @Override
    protected String visitLikePredicate(LikePredicate node, Boolean unmangleNames) {
      StringBuilder builder = new StringBuilder();

      builder
          .append('(')
          .append(process(node.getValue(), unmangleNames))
          .append(" LIKE ")
          .append(process(node.getPattern(), unmangleNames));

      if (node.getEscape() != null) {
        builder.append(" ESCAPE ").append(process(node.getEscape(), unmangleNames));
      }

      builder.append(')');

      return builder.toString();
    }