Skip to content

Commit

Permalink
[#4047] Add DSL.deleteFrom() alias for DSL.delete()
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed Feb 9, 2015
1 parent ee72f49 commit 528c13a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
10 changes: 9 additions & 1 deletion jOOQ/src/main/java/org/jooq/DSLContext.java
Expand Up @@ -4536,14 +4536,22 @@ public interface DSLContext extends Scope {
* Example: <code><pre>
* DSLContext create = DSL.using(configuration);
*
* create.delete(table)
* create.deleteFrom(table)
* .where(field1.greaterThan(100))
* .execute();
* </pre></code>
* <p>
* Some but not all databases support aliased tables in delete statements.
*/
@Support
<R extends Record> DeleteWhereStep<R> deleteFrom(Table<R> table);

/**
* Create a new DSL delete statement.
* <p>
* This is an alias for {@link #deleteFrom(Table)}
*/
@Support
<R extends Record> DeleteWhereStep<R> delete(Table<R> table);

// -------------------------------------------------------------------------
Expand Down
16 changes: 13 additions & 3 deletions jOOQ/src/main/java/org/jooq/impl/DSL.java
Expand Up @@ -4209,17 +4209,27 @@ public static <R extends Record> MergeKeyStepN<R> mergeInto(Table<R> table, Coll
*
* // [...]
*
* delete(table)
* deleteFrom(table)
* .where(field1.greaterThan(100))
* </pre></code>
* <p>
* Some but not all databases support aliased tables in delete statements.
*
* @see DSLContext#delete(Table)
* @see DSLContext#deleteFrom(Table)
*/
@Support
public static <R extends Record> DeleteWhereStep<R> deleteFrom(Table<R> table) {
return using(new DefaultConfiguration()).deleteFrom(table);
}

/**
* Create a new DSL delete statement.
* <p>
* This is an alias for {@link #deleteFrom(Table)}
*/
@Support
public static <R extends Record> DeleteWhereStep<R> delete(Table<R> table) {
return using(new DefaultConfiguration()).delete(table);
return using(new DefaultConfiguration()).deleteFrom(table);
}

// -------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
Expand Up @@ -1496,6 +1496,11 @@ public <R extends Record> DeleteQuery<R> deleteQuery(Table<R> table) {

@Override
public <R extends Record> DeleteWhereStep<R> delete(Table<R> table) {
return deleteFrom(table);
}

@Override
public <R extends Record> DeleteWhereStep<R> deleteFrom(Table<R> table) {
return new DeleteImpl<R>(configuration(), table);
}

Expand Down

0 comments on commit 528c13a

Please sign in to comment.