From 4bc883cef57e3c1fc995152400f6a3d55bc43c0a Mon Sep 17 00:00:00 2001 From: lukaseder Date: Wed, 23 Jan 2019 14:37:23 +0100 Subject: [PATCH] [#8247] Add DSL.truncate(String) overload for consistency --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index be8942d82a..a40fd3559f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -7938,6 +7938,53 @@ public class DSL { return dsl().dropSequenceIfExists(sequence); } + /** + * Create a new DSL truncate statement. + *

+ * Unlike {@link Delete} factory methods in the {@link DSLContext} API, this + * creates an unattached, and thus not directly renderable or executable + * DELETE statement. + *

+ * Example: + *

+ *

+     * import static org.jooq.impl.DSL.*;
+     *
+     * // [...]
+     *
+     * truncate(table);
+     * 
+ *

Simulation of TRUNCATE

+ *

+ * Most dialects implement the TRUNCATE statement. If it is not + * supported, it is emulated using an equivalent DELETE + * statement. This is particularly true for these dialects: + *

+ *

Vendor-specific extensions of TRUNCATE

+ *

+ * Some statements also support extensions of the TRUNCATE + * statement, such as Postgres: + *

+ *

+     * truncate(table)
+     *   .restartIdentity()
+     *   .cascade()
+     * 
+ *

+ * These vendor-specific extensions are currently not emulated for those + * dialects that do not support them natively. + * + * @see DSLContext#truncate(String) + */ + @Support + public static TruncateIdentityStep truncate(String table) { + return dsl().truncate(table); + } + /** * Create a new DSL truncate statement. *