[jOOQ/jOOQ#10408] Error in Sybase ASE INSERT .. DEFAULT VALUES emulation when used with identity column

This commit is contained in:
Lukas Eder 2020-07-16 14:49:31 +02:00
parent 5bf67a30c8
commit b16664d1ec

View File

@ -55,6 +55,7 @@ import static org.jooq.SQLDialect.MYSQL;
// ...
// ...
import static org.jooq.impl.DSL.constraint;
import static org.jooq.impl.DSL.defaultValue;
import static org.jooq.impl.DSL.dual;
import static org.jooq.impl.DSL.falseCondition;
import static org.jooq.impl.DSL.name;
@ -677,6 +678,22 @@ final class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
@ -685,13 +702,9 @@ final class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
case DERBY:
case MARIADB:
case MYSQL:
ctx.formatSeparator()
.visit(K_VALUES)
.sql(" (")
.visit(wrap(nCopies(table().fields().length, K_DEFAULT)))
.sql(')');
acceptDefaultValuesEmulation(ctx, table().fields().length);
break;
default:
ctx.formatSeparator()
.visit(K_DEFAULT_VALUES);
@ -713,6 +726,14 @@ final class InsertQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
}
}
private final void acceptDefaultValuesEmulation(Context<?> ctx, int length) {
ctx.formatSeparator()
.visit(K_VALUES)
.sql(" (")
.visit(wrap(nCopies(length, K_DEFAULT)))
.sql(')');
}