]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/database/GigiPreparedStatement.java
Merge "Fix error message"
[gigi.git] / src / org / cacert / gigi / database / GigiPreparedStatement.java
index a779f965fb56c150a2329b9dc6bddb6fd4842424..4dea5f981f68eb28679734eb1ed88c74e2dc7328 100644 (file)
@@ -49,6 +49,19 @@ public class GigiPreparedStatement implements AutoCloseable {
         }
     }
 
+    public boolean executeMaybeUpdate() {
+        try {
+            int updated = target.executeUpdate();
+            if (updated > 1) {
+                throw new Error("More than one record (" + updated + ") updated.");
+            }
+            return updated == 1;
+        } catch (SQLException e) {
+            handleSQL(e);
+            throw new Error(e);
+        }
+    }
+
     public boolean execute() {
         try {
             return target.execute();