Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-05-20 02:46:23 -0400
committerEike Stepper2013-05-20 02:47:28 -0400
commit8b7c426b2b27f219a6519d08a5cc3ec4741b4092 (patch)
treea97c6db1794a3a483b49951a94ef7c95aa721a8b
parentb533cfe47685b48e8c43984d04082110e5e648a3 (diff)
downloadcdo-8b7c426b2b27f219a6519d08a5cc3ec4741b4092.tar.gz
cdo-8b7c426b2b27f219a6519d08a5cc3ec4741b4092.tar.xz
cdo-8b7c426b2b27f219a6519d08a5cc3ec4741b4092.zip
Make DBUtil.rollbackSilently() public
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java17
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBSchemaTransaction.java5
2 files changed, 17 insertions, 5 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 23322a9f34..8c8b69fa5d 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
@@ -329,7 +329,7 @@ public final class DBUtil
catch (SQLException ex)
{
OM.LOG.error(ex);
- rollback(connection);
+ rollbackSilently(connection);
throw new DBException(ex);
}
finally
@@ -444,7 +444,7 @@ public final class DBUtil
// first to clear any open transactions.
if (!connection.getAutoCommit())
{
- rollback(connection);
+ rollbackSilently(connection);
}
connection.close();
@@ -480,15 +480,24 @@ public final class DBUtil
}
}
- private static void rollback(Connection connection)
+ /**
+ * @since 4.2
+ */
+ public static Exception rollbackSilently(Connection connection)
{
try
{
- connection.rollback();
+ if (!connection.getAutoCommit())
+ {
+ connection.rollback();
+ }
+
+ return null;
}
catch (Exception ex)
{
OM.LOG.error(ex);
+ return ex;
}
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBSchemaTransaction.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBSchemaTransaction.java
index 8d32c6c901..970a166624 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBSchemaTransaction.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBSchemaTransaction.java
@@ -101,10 +101,13 @@ public final class DBSchemaTransaction implements IDBSchemaTransaction, Runnable
try
{
- return run(connection);
+ DBSchemaDelta result = run(connection);
+ connection.commit();
+ return result;
}
catch (SQLException ex)
{
+ DBUtil.rollbackSilently(connection);
throw new DBException(ex);
}
}

Back to the top