Example #1
0
  @Override
  public final void accept(Context<?> ctx) {
    if (conditions.isEmpty()) {
      ctx.visit(trueCondition());
    } else if (conditions.size() == 1) {
      ctx.visit(conditions.get(0));
    } else {
      ctx.sql("(").formatIndentStart().formatNewLine();

      String operatorName = operator.name().toLowerCase() + " ";
      String separator = "";

      for (int i = 0; i < conditions.size(); i++) {
        if (i > 0) {
          ctx.formatSeparator();
        }

        ctx.keyword(separator);
        ctx.visit(conditions.get(i));
        separator = operatorName;
      }

      ctx.formatIndentEnd().formatNewLine().sql(")");
    }
  }
Example #2
0
  private final void accept0(Context<?> ctx, boolean asStringLiterals) {
    Schema mappedSchema = Utils.getMappedSchema(ctx.configuration(), schema);

    if (mappedSchema != null && ctx.family() != CUBRID) {
      if (asStringLiterals) {
        ctx.visit(inline(mappedSchema.getName())).sql(", ");
      } else {
        ctx.visit(mappedSchema).sql('.');
      }
    }

    if (asStringLiterals) ctx.visit(inline(name));
    else if (nameIsPlainSQL) ctx.sql(name);
    else ctx.literal(name);
  }
Example #3
0
  private void accept0(Context<?> ctx) {
    ctx.start(DROP_SEQUENCE_SEQUENCE)
        .keyword("drop")
        .sql(' ')
        .keyword(ctx.family() == CUBRID ? "serial" : "sequence")
        .sql(' ');

    if (ifExists && supportsIfExists(ctx)) ctx.keyword("if exists").sql(' ');

    ctx.visit(sequence);

    if (ctx.family() == DERBY) ctx.sql(' ').keyword("restrict");

    ctx.end(DROP_SEQUENCE_SEQUENCE);
  }
Example #4
0
 @Override
 public final void accept(Context<?> ctx) {
   ctx.visit(alias);
 }
Example #5
0
 @Override
 public final void accept(Context<?> ctx) {
   ctx.visit(delegate(ctx.configuration()));
 }