X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fdatabase%2FGigiPreparedStatement.java;h=4dea5f981f68eb28679734eb1ed88c74e2dc7328;hb=a61a2d320cc2bb730528832133a8220cb5b80d68;hp=a779f965fb56c150a2329b9dc6bddb6fd4842424;hpb=0b86fb147b4a61f315770fa5bba4466ca18ddfa8;p=gigi.git diff --git a/src/org/cacert/gigi/database/GigiPreparedStatement.java b/src/org/cacert/gigi/database/GigiPreparedStatement.java index a779f965..4dea5f98 100644 --- a/src/org/cacert/gigi/database/GigiPreparedStatement.java +++ b/src/org/cacert/gigi/database/GigiPreparedStatement.java @@ -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();