Untitled
unknown
plain_text
3 years ago
1.6 kB
11
Indexable
Connection mysqlConnection = null;
PreparedStatement deleteStmt = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
mysqlConnection = DatabaseManager.getConnection();
stmt = mysqlConnection.prepareStatement("SELECT pub_broadcast_uid FROM xxxx WHERE addr=?");
stmt.setString(1, ServerStatus.getServerAddr());
rs = stmt.executeQuery();
while (rs.next()) {
PubBroadcast broadcast = getBroadcast(rs.getInt("pub_broadcast_uid"));
if (broadcast == null || !broadcast.getPubStatusModule().isBroadcastPublished()) {
deleteStmt = mysqlConnection.prepareStatement("DELETE FROM xxxx WHERE pub_broadcast_uid=? LIMIT 1");
deleteStmt.setInt(1, rs.getInt("pub_broadcast_uid"));
deleteStmt.execute();
}
}
} catch (BroadcastIsNotYetInitializedException e) {
/*
Nic nie robimy
*/
} catch (Exception e) {
logger.error("PubBroadcastManager checkBroadcastsOnlineIntegrity Exception:", e);
throw e;
} finally {
if (rs != null)
DatabaseManager.attemptClose(rs);
if (deleteStmt != null)
DatabaseManager.attemptClose(deleteStmt);
if (stmt != null)
DatabaseManager.attemptClose(stmt);
if (mysqlConnection != null)
DatabaseManager.attemptClose(mysqlConnection);
}Editor is loading...