Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2011-12-14 14:11:02 +0000
committerStefan Winkler2011-12-15 14:52:59 +0000
commitd4e95f1f7e527ef049a558f5a31bbdd67f687ac3 (patch)
tree4a68badc157e04516306984173dbea6ff7b1daca /plugins/org.eclipse.net4j.db
parentb75f79c12e523abdadca942873edc939523f5985 (diff)
downloadcdo-d4e95f1f7e527ef049a558f5a31bbdd67f687ac3.tar.gz
cdo-d4e95f1f7e527ef049a558f5a31bbdd67f687ac3.tar.xz
cdo-d4e95f1f7e527ef049a558f5a31bbdd67f687ac3.zip
[366686] [DB] Reduce amount of update statements for non-audit mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=366686
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
index 0aa500536f..ac34132b4b 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
@@ -523,6 +523,14 @@ public final class DBUtil
*/
public static void executeBatch(PreparedStatement stmt, int counter)
{
+ executeBatch(stmt, counter, true);
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static void executeBatch(PreparedStatement stmt, int counter, boolean checkExactlyOne)
+ {
try
{
int[] results = stmt.executeBatch();
@@ -534,10 +542,14 @@ public final class DBUtil
for (int i = 0; i < results.length; i++)
{
int result = results[i];
- if (result != 1 && result != Statement.SUCCESS_NO_INFO)
+ if (result < 0 && result != Statement.SUCCESS_NO_INFO)
{
throw new DBException("Result " + i + " is not successful: " + result);
}
+ else if (checkExactlyOne && result != 1)
+ {
+ throw new DBException("Result " + i + " did not affect exactly one row: " + result);
+ }
}
}
catch (SQLException ex)

Back to the top