Example #1
0
  public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
    switch (typeName) {
      case BOOLEAN:
        writer.keyword(value == null ? "UNKNOWN" : (Boolean) value ? "TRUE" : "FALSE");
        break;
      case NULL:
        writer.keyword("NULL");
        break;
      case CHAR:
      case DECIMAL:
      case DOUBLE:
      case BINARY:

        // should be handled in subtype
        throw Util.unexpected(typeName);

      case SYMBOL:
        if (value instanceof Enum) {
          Enum enumVal = (Enum) value;
          writer.keyword(enumVal.toString());
        } else {
          writer.keyword(String.valueOf(value));
        }
        break;
      default:
        writer.literal(value.toString());
    }
  }
 @Override
 public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
   super.unparse(writer, call, leftPrec, rightPrec);
   if (withOrdinality) {
     writer.keyword("WITH ORDINALITY");
   }
 }
 public void unparse(
     SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) {
   assert call.operandCount() == 1;
   call.operand(0).unparse(writer, operator.getLeftPrec(), operator.getRightPrec());
   writer.keyword(operator.getName());
 }