[#2464] Skip tests for some databases
This commit is contained in:
parent
d1458dfea4
commit
9d9fa20b3b
@ -193,6 +193,13 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
@Test
|
||||
public void testAliasingDelete() throws Exception {
|
||||
switch (dialect()) {
|
||||
case SQLITE:
|
||||
case SQLSERVER:
|
||||
log.info("SKIPPING", "Aliasing DELETE tests");
|
||||
return;
|
||||
}
|
||||
|
||||
jOOQAbstractTest.reset = false;
|
||||
Table<B2S> b = TBookToBookStore().as("b");
|
||||
|
||||
|
||||
@ -4194,6 +4194,8 @@ public interface DSLContext {
|
||||
* .where(field1.greaterThan(100))
|
||||
* .execute();
|
||||
* </pre></code>
|
||||
* <p>
|
||||
* Some but not all databases support aliased tables in delete statements.
|
||||
*/
|
||||
@Support
|
||||
@Transition(
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jooq.BindContext;
|
||||
@ -101,7 +103,16 @@ class DeleteQueryImpl<R extends Record> extends AbstractQuery implements DeleteQ
|
||||
public final void toSQL(RenderContext context) {
|
||||
boolean declare = context.declareTables();
|
||||
|
||||
context.keyword("delete from ");
|
||||
context.keyword("delete ");
|
||||
|
||||
// [#2464] MySQL supports a peculiar multi-table DELETE syntax for aliased tables:
|
||||
// DELETE t1 FROM my_table AS t1
|
||||
if (getFrom() instanceof TableAlias && context.configuration().dialect() == MYSQL) {
|
||||
context.sql(getFrom())
|
||||
.sql(" ");
|
||||
}
|
||||
|
||||
context.keyword("from ");
|
||||
context.declareTables(true)
|
||||
.sql(getFrom())
|
||||
.declareTables(declare);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user