[jOOQ/jOOQ#2356] Support PostgreSQL multi table TRUNCATE statement

This commit is contained in:
Lukas Eder 2023-09-07 17:26:29 +02:00
parent dd52536fa0
commit 8c72eb8ccb
5 changed files with 297 additions and 58 deletions

View File

@ -10280,7 +10280,7 @@ public interface DSLContext extends Scope {
* @see DSL#createType(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
CreateTypeStep createType(@Stringly.Name String type);
/**
@ -10289,7 +10289,7 @@ public interface DSLContext extends Scope {
* @see DSL#createType(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
CreateTypeStep createType(Name type);
/**
@ -10298,7 +10298,7 @@ public interface DSLContext extends Scope {
* @see DSL#createType(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
CreateTypeStep createType(Type<?> type);
/**
@ -10307,7 +10307,7 @@ public interface DSLContext extends Scope {
* @see DSL#createTypeIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
CreateTypeStep createTypeIfNotExists(@Stringly.Name String type);
/**
@ -10316,7 +10316,7 @@ public interface DSLContext extends Scope {
* @see DSL#createTypeIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
CreateTypeStep createTypeIfNotExists(Name type);
/**
@ -10325,7 +10325,7 @@ public interface DSLContext extends Scope {
* @see DSL#createTypeIfNotExists(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
CreateTypeStep createTypeIfNotExists(Type<?> type);
/**
@ -10952,7 +10952,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(@Stringly.Name String types);
/**
@ -10961,7 +10961,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(Name types);
/**
@ -10970,7 +10970,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(Type<?> types);
/**
@ -10979,7 +10979,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(String...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(@Stringly.Name String... types);
/**
@ -10988,7 +10988,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(Name...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(Name... types);
/**
@ -10997,7 +10997,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(Type...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(Type<?>... types);
/**
@ -11006,7 +11006,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropType(Collection)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropType(Collection<? extends Type<?>> types);
/**
@ -11015,7 +11015,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(@Stringly.Name String types);
/**
@ -11024,7 +11024,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(Name types);
/**
@ -11033,7 +11033,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(Type<?> types);
/**
@ -11042,7 +11042,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(String...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(@Stringly.Name String... types);
/**
@ -11051,7 +11051,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(Name...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(Name... types);
/**
@ -11060,7 +11060,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(Type...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(Type<?>... types);
/**
@ -11069,7 +11069,7 @@ public interface DSLContext extends Scope {
* @see DSL#dropTypeIfExists(Collection)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
DropTypeStep dropTypeIfExists(Collection<? extends Type<?>> types);
/**
@ -11344,6 +11344,42 @@ public interface DSLContext extends Scope {
@Support
<R extends Record> TruncateIdentityStep<R> truncate(Table<R> table);
/**
* The <code>TRUNCATE</code> statement.
*
* @see DSL#truncate(String...)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncate(@Stringly.Name String... table);
/**
* The <code>TRUNCATE</code> statement.
*
* @see DSL#truncate(Name...)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncate(Name... table);
/**
* The <code>TRUNCATE</code> statement.
*
* @see DSL#truncate(Table...)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncate(Table<?>... table);
/**
* The <code>TRUNCATE</code> statement.
*
* @see DSL#truncate(Collection)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncate(Collection<? extends Table<?>> table);
/**
* The <code>TRUNCATE TABLE</code> statement.
*
@ -11371,6 +11407,42 @@ public interface DSLContext extends Scope {
@Support
<R extends Record> TruncateIdentityStep<R> truncateTable(Table<R> table);
/**
* The <code>TRUNCATE TABLE</code> statement.
*
* @see DSL#truncateTable(String...)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncateTable(@Stringly.Name String... table);
/**
* The <code>TRUNCATE TABLE</code> statement.
*
* @see DSL#truncateTable(Name...)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncateTable(Name... table);
/**
* The <code>TRUNCATE TABLE</code> statement.
*
* @see DSL#truncateTable(Table...)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncateTable(Table<?>... table);
/**
* The <code>TRUNCATE TABLE</code> statement.
*
* @see DSL#truncateTable(Collection)
*/
@NotNull @CheckReturnValue
@Support
TruncateIdentityStep<Record> truncateTable(Collection<? extends Table<?>> table);

View File

@ -8779,7 +8779,7 @@ public class DSL {
* @see DSLContext#createType(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTypeStep createType(@Stringly.Name String type) {
return dsl().createType(type);
}
@ -8794,7 +8794,7 @@ public class DSL {
* @see DSLContext#createType(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTypeStep createType(Name type) {
return dsl().createType(type);
}
@ -8809,7 +8809,7 @@ public class DSL {
* @see DSLContext#createType(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTypeStep createType(Type<?> type) {
return dsl().createType(type);
}
@ -8824,7 +8824,7 @@ public class DSL {
* @see DSLContext#createTypeIfNotExists(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTypeStep createTypeIfNotExists(@Stringly.Name String type) {
return dsl().createTypeIfNotExists(type);
}
@ -8839,7 +8839,7 @@ public class DSL {
* @see DSLContext#createTypeIfNotExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTypeStep createTypeIfNotExists(Name type) {
return dsl().createTypeIfNotExists(type);
}
@ -8854,7 +8854,7 @@ public class DSL {
* @see DSLContext#createTypeIfNotExists(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.CreateTypeStep createTypeIfNotExists(Type<?> type) {
return dsl().createTypeIfNotExists(type);
}
@ -9883,7 +9883,7 @@ public class DSL {
* @see DSLContext#dropType(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(@Stringly.Name String types) {
return dsl().dropType(types);
}
@ -9898,7 +9898,7 @@ public class DSL {
* @see DSLContext#dropType(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(Name types) {
return dsl().dropType(types);
}
@ -9913,7 +9913,7 @@ public class DSL {
* @see DSLContext#dropType(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(Type<?> types) {
return dsl().dropType(types);
}
@ -9928,7 +9928,7 @@ public class DSL {
* @see DSLContext#dropType(String...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(@Stringly.Name String... types) {
return dsl().dropType(types);
}
@ -9943,7 +9943,7 @@ public class DSL {
* @see DSLContext#dropType(Name...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(Name... types) {
return dsl().dropType(types);
}
@ -9958,7 +9958,7 @@ public class DSL {
* @see DSLContext#dropType(Type...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(Type<?>... types) {
return dsl().dropType(types);
}
@ -9973,7 +9973,7 @@ public class DSL {
* @see DSLContext#dropType(Collection)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropType(Collection<? extends Type<?>> types) {
return dsl().dropType(types);
}
@ -9988,7 +9988,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(String)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(@Stringly.Name String types) {
return dsl().dropTypeIfExists(types);
}
@ -10003,7 +10003,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(Name)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(Name types) {
return dsl().dropTypeIfExists(types);
}
@ -10018,7 +10018,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(Type)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(Type<?> types) {
return dsl().dropTypeIfExists(types);
}
@ -10033,7 +10033,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(String...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(@Stringly.Name String... types) {
return dsl().dropTypeIfExists(types);
}
@ -10048,7 +10048,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(Name...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(Name... types) {
return dsl().dropTypeIfExists(types);
}
@ -10063,7 +10063,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(Type...)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(Type<?>... types) {
return dsl().dropTypeIfExists(types);
}
@ -10078,7 +10078,7 @@ public class DSL {
* @see DSLContext#dropTypeIfExists(Collection)
*/
@NotNull @CheckReturnValue
@Support({ H2, POSTGRES, YUGABYTEDB })
@Support({ DUCKDB, H2, POSTGRES, YUGABYTEDB })
public static org.jooq.DropTypeStep dropTypeIfExists(Collection<? extends Type<?>> types) {
return dsl().dropTypeIfExists(types);
}
@ -10523,6 +10523,66 @@ public class DSL {
return dsl().truncate(table);
}
/**
* The <code>TRUNCATE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncate(String...)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncate(@Stringly.Name String... table) {
return dsl().truncate(table);
}
/**
* The <code>TRUNCATE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncate(Name...)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncate(Name... table) {
return dsl().truncate(table);
}
/**
* The <code>TRUNCATE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncate(Table...)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncate(Table<?>... table) {
return dsl().truncate(table);
}
/**
* The <code>TRUNCATE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncate(Collection)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncate(Collection<? extends Table<?>> table) {
return dsl().truncate(table);
}
/**
* The <code>TRUNCATE TABLE</code> statement.
* <p>
@ -10568,6 +10628,66 @@ public class DSL {
return dsl().truncateTable(table);
}
/**
* The <code>TRUNCATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncateTable(String...)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncateTable(@Stringly.Name String... table) {
return dsl().truncateTable(table);
}
/**
* The <code>TRUNCATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncateTable(Name...)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncateTable(Name... table) {
return dsl().truncateTable(table);
}
/**
* The <code>TRUNCATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncateTable(Table...)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncateTable(Table<?>... table) {
return dsl().truncateTable(table);
}
/**
* The <code>TRUNCATE TABLE</code> statement.
* <p>
* Unlike statement construction methods in the {@link DSLContext} API, this
* creates an unattached, and thus not directly renderable or executable
* statement. It can be used as a subquery or nested in procedural logic.
*
* @see DSLContext#truncateTable(Collection)
*/
@NotNull @CheckReturnValue
@Support
public static org.jooq.TruncateIdentityStep<Record> truncateTable(Collection<? extends Table<?>> table) {
return dsl().truncateTable(table);
}

View File

@ -3999,17 +3999,37 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
@Override
public org.jooq.TruncateIdentityStep<Record> truncate(@Stringly.Name String table) {
return new TruncateImpl(configuration(), DSL.table(DSL.name(table)));
return new TruncateImpl(configuration(), Arrays.asList(DSL.table(table)));
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncate(Name table) {
return new TruncateImpl(configuration(), DSL.table(table));
return new TruncateImpl(configuration(), Arrays.asList(DSL.table(table)));
}
@Override
public <R extends Record> org.jooq.TruncateIdentityStep<R> truncate(Table<R> table) {
return new TruncateImpl(configuration(), table);
return new TruncateImpl(configuration(), Arrays.asList(table));
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncate(@Stringly.Name String... table) {
return new TruncateImpl(configuration(), Tools.map(table, e -> DSL.table(e)));
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncate(Name... table) {
return new TruncateImpl(configuration(), Tools.map(table, e -> DSL.table(e)));
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncate(Table<?>... table) {
return new TruncateImpl(configuration(), Arrays.asList(table));
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncate(Collection<? extends Table<?>> table) {
return new TruncateImpl(configuration(), new QueryPartList<>(table));
}
@Override
@ -4026,6 +4046,26 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
public <R extends Record> org.jooq.TruncateIdentityStep<R> truncateTable(Table<R> table) {
return truncate(table);
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncateTable(@Stringly.Name String... table) {
return truncate(table);
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncateTable(Name... table) {
return truncate(table);
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncateTable(Table<?>... table) {
return truncate(table);
}
@Override
public org.jooq.TruncateIdentityStep<Record> truncateTable(Collection<? extends Table<?>> table) {
return truncate(table);
}

View File

@ -2674,11 +2674,11 @@ public final class QOM {
//permits
// TruncateImpl
{
@NotNull Table<R> $table();
@NotNull UnmodifiableList<? extends Table<?>> $table();
@Nullable IdentityRestartOption $restartIdentity();
@Nullable Cascade $cascade();
@CheckReturnValue
@NotNull Truncate<R> $table(Table<R> table);
@NotNull Truncate<R> $table(Collection<? extends Table<?>> table);
@CheckReturnValue
@NotNull Truncate<R> $restartIdentity(IdentityRestartOption restartIdentity);
@CheckReturnValue

View File

@ -64,7 +64,7 @@ import java.util.stream.*;
/**
* The <code>TRUNCATE</code> statement.
*/
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
@SuppressWarnings({ "rawtypes", "unused" })
final class TruncateImpl<R extends Record>
extends
AbstractDDLQuery
@ -76,13 +76,13 @@ implements
org.jooq.Truncate<R>
{
final Table<R> table;
IdentityRestartOption restartIdentity;
Cascade cascade;
final QueryPartListView<? extends Table<?>> table;
IdentityRestartOption restartIdentity;
Cascade cascade;
TruncateImpl(
Configuration configuration,
Table<R> table
Collection<? extends Table<?>> table
) {
this(
configuration,
@ -94,13 +94,13 @@ implements
TruncateImpl(
Configuration configuration,
Table<R> table,
Collection<? extends Table<?>> table,
IdentityRestartOption restartIdentity,
Cascade cascade
) {
super(configuration);
this.table = table;
this.table = new QueryPartList<>(table);
this.restartIdentity = restartIdentity;
this.cascade = cascade;
}
@ -152,7 +152,14 @@ implements
case FIREBIRD:
case IGNITE:
case SQLITE: {
ctx.visit(delete(table));
if (table.size() == 1) {
ctx.visit(delete(table.get(0)));
}
else {
ctx.sql("[Cannot emulate multi-table truncate using DELETE yet]");
log.warn("Multi table truncate", "Cannot emulate multi-table truncate using DELETE yet");
}
break;
}
@ -202,8 +209,8 @@ implements
// -------------------------------------------------------------------------
@Override
public final Table<R> $table() {
return table;
public final UnmodifiableList<? extends Table<?>> $table() {
return QOM.unmodifiable(table);
}
@Override
@ -217,7 +224,7 @@ implements
}
@Override
public final QOM.Truncate<R> $table(Table<R> newValue) {
public final QOM.Truncate<R> $table(Collection<? extends Table<?>> newValue) {
return $constructor().apply(newValue, $restartIdentity(), $cascade());
}
@ -231,8 +238,8 @@ implements
return $constructor().apply($table(), $restartIdentity(), newValue);
}
public final Function3<? super Table<R>, ? super IdentityRestartOption, ? super Cascade, ? extends QOM.Truncate<R>> $constructor() {
return (a1, a2, a3) -> new TruncateImpl(configuration(), a1, a2, a3);
public final Function3<? super Collection<? extends Table<?>>, ? super IdentityRestartOption, ? super Cascade, ? extends QOM.Truncate<R>> $constructor() {
return (a1, a2, a3) -> new TruncateImpl(configuration(), (Collection<? extends Table<?>>) a1, a2, a3);
}