added further tests and adjustments to these for calculations
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user