Skip to content

Commit

Permalink
Issue #513
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrojdeCTL committed Sep 27, 2018
1 parent d66eaad commit 6f9cd8f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions mdw-common/src/com/centurylink/mdw/cli/Checkpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,25 @@ public void updateRef(AssetRef ref) throws SQLException, IOException {
}

public void updateRefValue() throws SQLException, IOException {
String select = "select name from value where name = ? and owner_type = ? and owner_id = ?";
String select = "select value from value where name = ? and owner_type = ? and owner_id = ?";
try (Connection conn = getDbConnection();
PreparedStatement stmt = conn.prepareStatement(select)) {
stmt.setString(1, "CommitID");
stmt.setString(2, "AssetImport");
stmt.setString(3, "0");
try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
String update = "update value set value = ?, mod_dt = ? where name = ? and owner_type = ? and owner_id = ?";
try (PreparedStatement updateStmt = conn.prepareStatement(update)) {
updateStmt.setString(1, commit);
updateStmt.setDate(2, (java.sql.Date) new Date());
updateStmt.setString(3, "CommitID");
updateStmt.setString(4, "AssetImport");
updateStmt.setString(5, "0");
updateStmt.executeUpdate();
if (!conn.getAutoCommit()) conn.commit();
if (!commit.equals(rs.getString("value"))) {
String update = "update value set value = ?, mod_dt = ? where name = ? and owner_type = ? and owner_id = ?";
try (PreparedStatement updateStmt = conn.prepareStatement(update)) {
updateStmt.setString(1, commit);
updateStmt.setDate(2, (java.sql.Date) new Date());
updateStmt.setString(3, "CommitID");
updateStmt.setString(4, "AssetImport");
updateStmt.setString(5, "0");
updateStmt.executeUpdate();
if (!conn.getAutoCommit()) conn.commit();
}
}
}
else {
Expand Down

0 comments on commit 6f9cd8f

Please sign in to comment.