added further tests and adjustments to these for calculations

This commit is contained in:
christian
2021-11-29 19:37:52 +01:00
parent bd8b63bc8d
commit 5273eb3b6e
4 changed files with 381 additions and 69 deletions
@@ -85,13 +85,21 @@ public class DataMapper {
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" +
" where DATE(last_used) < DATE_SUB(CURDATE(), INTERVAL 32 DAY)\n" +
" order by last_used asc limit 3";
" order by last_used asc limit 5";
try {
l_cCon = DBCPDataSource.getConnection();
l_pStatement = l_cCon.prepareStatement(l_sSQL);
l_pStatement.execute();
l_pStatement = l_cCon.prepareStatement(CountSQL);
ResultSet resultSet = l_pStatement.executeQuery();
if (resultSet.next()) {
int count = resultSet.getInt(1);
if (count > 8500) {
l_pStatement = l_cCon.prepareStatement(l_sSQL);
l_pStatement.execute();
}
}
} catch (SQLException throwables) {
throwables.printStackTrace();
} finally {