removed thread pool again and hopefully deleting works as intended now
This commit is contained in:
@@ -84,27 +84,26 @@ public class DataMapper {
|
||||
}
|
||||
|
||||
public static void checkStringsToDelete() {
|
||||
Connection l_cCon = null;
|
||||
PreparedStatement l_pStatement = null;
|
||||
ResultSet l_rsSearch = null;
|
||||
String CountSQL = "select count(*) from Sentences";
|
||||
String l_sSQL = "delete from Sentences\n" +
|
||||
" order by last_used asc limit 5";
|
||||
try {
|
||||
l_cCon = DBCPDataSource.getConnection();
|
||||
String l_sSQL = "delete from Sentences order by last_used asc limit 5;";
|
||||
try (Connection l_cCon = DBCPDataSource.getConnection()) {
|
||||
l_pStatement = l_cCon.prepareStatement(CountSQL);
|
||||
ResultSet resultSet = l_pStatement.executeQuery();
|
||||
if (resultSet.next()) {
|
||||
int count = resultSet.getInt(1);
|
||||
if (count > 7000) {
|
||||
//System.out.println("cleaning strings: " + l_sSQL);
|
||||
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
||||
l_pStatement.execute();
|
||||
l_pStatement.executeUpdate();
|
||||
l_cCon.commit();
|
||||
}
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
} finally {
|
||||
CloseConnections(l_pStatement, l_rsSearch, l_cCon);
|
||||
CloseConnections(l_pStatement, l_rsSearch, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user