mirror of https://github.com/apache/openjpa.git
Don't bother using a subselect in bulk UPDATE or DELETE clauses if there is no where condition, since it does the exact same think as an unqulaified bulk operation.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@442385 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1defd23037
commit
f56a7555a7
|
@ -1792,6 +1792,17 @@ public class DBDictionary
|
|||
return sql;
|
||||
}
|
||||
|
||||
Table table = mapping.getTable();
|
||||
String tableName = getFullName(table, false);
|
||||
|
||||
// only use a subselect if the where is not empty; otherwise
|
||||
// an unqualified delete or update will work
|
||||
if (sel.getWhere() == null || sel.getWhere().isEmpty()) {
|
||||
sql.append(tableName);
|
||||
appendUpdates(sel, store, sql, params, updateParams, false);
|
||||
return sql;
|
||||
}
|
||||
|
||||
// we need to use a subselect if we are to bulk delete where
|
||||
// the select includes multiple tables; if the database
|
||||
// doesn't support it, then we need to sigal this by returning null
|
||||
|
@ -1799,8 +1810,6 @@ public class DBDictionary
|
|||
return null;
|
||||
|
||||
Column[] pks = mapping.getPrimaryKeyColumns();
|
||||
Table table = mapping.getTable();
|
||||
String tableName = getFullName(table, false);
|
||||
sel.clearSelects();
|
||||
sel.setDistinct(true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue