X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fdatabase%2FDatabaseConnection.java;h=6bed8bd979c2f62aec1b7922779bed3048716063;hb=2578d4a6931685e2fc5a5f4cb982862f05886123;hp=9cbcaeb5140fc58487d4602949942634166e123f;hpb=7cf984749cf0027ccae90a53ebef07ab97ff164b;p=gigi.git diff --git a/src/org/cacert/gigi/database/DatabaseConnection.java b/src/org/cacert/gigi/database/DatabaseConnection.java index 9cbcaeb5..6bed8bd9 100644 --- a/src/org/cacert/gigi/database/DatabaseConnection.java +++ b/src/org/cacert/gigi/database/DatabaseConnection.java @@ -44,7 +44,8 @@ public class DatabaseConnection { ensureOpen(); PreparedStatement statement = statements.get(query); if (statement == null) { - statement = c.prepareStatement(query); + statement = c.prepareStatement(query, + Statement.RETURN_GENERATED_KEYS); statements.put(query, statement); } return statement; @@ -80,6 +81,9 @@ public class DatabaseConnection { public static DatabaseConnection getInstance() { return instances.get(); } + public static boolean isInited() { + return credentials != null; + } public static void init(Properties conf) { if (credentials != null) { throw new Error("Re-initiaizing is forbidden.");