예제 #1
0
  @Override
  public final void accept(Context<?> ctx) {

    // If this is already a subquery, proceed
    if (ctx.subquery()) {
      ctx.keyword(quantifier.toSQL())
          .sql(" (")
          .formatIndentStart()
          .formatNewLine()
          .visit(delegate(ctx.configuration()))
          .formatIndentEnd()
          .formatNewLine()
          .sql(")");
    } else {
      ctx.keyword(quantifier.toSQL())
          .sql(" (")
          .subquery(true)
          .formatIndentStart()
          .formatNewLine()
          .visit(delegate(ctx.configuration()))
          .formatIndentEnd()
          .formatNewLine()
          .subquery(false)
          .sql(")");
    }
  }
예제 #2
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(")");
    }
  }
예제 #3
0
파일: Neg.java 프로젝트: siwiwit/jOOQ
  @Override
  public final void accept(Context<?> ctx) {
    SQLDialect family = ctx.configuration().dialect().family();

    if (operator == BIT_NOT && asList(H2, HSQLDB).contains(family)) {
      ctx.sql("(0 - ").visit(field).sql(" - 1)");
    } else if (operator == BIT_NOT && family == FIREBIRD) {
      ctx.keyword("bin_not(").visit(field).sql(')');
    } else {
      ctx.sql(operator.toSQL()).sql('(').visit(field).sql(')');
    }
  }
예제 #4
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);
  }