[#6103] Excess whitespace in formatted MySQL WITH ROLLUP clause

This commit is contained in:
lukaseder 2017-04-19 11:03:29 +02:00
parent d878dda6eb
commit 0f8000eddc
2 changed files with 24 additions and 1 deletions

View File

@ -261,6 +261,7 @@ final class Keywords {
public static final Keyword K_WITH_LOCK = keyword("with lock");
public static final Keyword K_WITH_PRIMARY_KEY = keyword("with primary key");
public static final Keyword K_WITH_READ_ONLY = keyword("with read only");
public static final Keyword K_WITH_ROLLUP = keyword("with rollup");
public static final Keyword K_WITHIN_GROUP = keyword("within group");
public static final Keyword K_XMLTABLE = keyword("xmltable");
public static final Keyword K_YEAR_TO_DAY = keyword("year to day");

View File

@ -34,6 +34,8 @@
*/
package org.jooq.impl;
import static org.jooq.impl.Keywords.K_WITH_ROLLUP;
import org.jooq.Clause;
import org.jooq.Configuration;
import org.jooq.Context;
@ -72,10 +74,30 @@ final class Rollup extends AbstractField<Object> {
case CUBRID:
case MARIADB:
case MYSQL:
return DSL.field("{0} {with rollup}", arguments);
return new MySQLWithRollup();
default:
return DSL.field("{rollup}({0})", Object.class, arguments);
}
}
final class MySQLWithRollup extends AbstractQueryPart {
/**
* Generated UID
*/
private static final long serialVersionUID = 2814185308000330197L;
@Override
public final void accept(Context<?> ctx) {
ctx.visit(arguments)
.formatSeparator()
.visit(K_WITH_ROLLUP);
}
@Override
public final Clause[] clauses(Context<?> ctx) {
return null;
}
}
}