Search in sources :

Example 11 with ExecStatement

use of com.djrapitops.plan.storage.database.transactions.ExecStatement in project Plan by plan-player-analytics.

the class StoreServerTableResultTransaction method deleteOldRows.

private void deleteOldRows(Integer tableID, int afterRow) {
    String sql = DELETE_FROM + TABLE_NAME + WHERE + TABLE_ID + "=?" + AND + SERVER_UUID + "=?" + AND + TABLE_ROW + // Since row count is zero indexed and afterRow is size the value should be removed.
    ">=?";
    execute(new ExecStatement(sql) {

        @Override
        public void prepare(PreparedStatement statement) throws SQLException {
            statement.setInt(1, tableID);
            statement.setString(2, serverUUID.toString());
            statement.setInt(3, afterRow);
        }
    });
}
Also used : SQLException(java.sql.SQLException) PreparedStatement(java.sql.PreparedStatement) ExecStatement(com.djrapitops.plan.storage.database.transactions.ExecStatement)

Aggregations

ExecStatement (com.djrapitops.plan.storage.database.transactions.ExecStatement)11 PreparedStatement (java.sql.PreparedStatement)11 SQLException (java.sql.SQLException)10 StoreServerInformationTransaction (com.djrapitops.plan.storage.database.transactions.StoreServerInformationTransaction)1 Transaction (com.djrapitops.plan.storage.database.transactions.Transaction)1 RemoveEverythingTransaction (com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction)1 RepeatedTest (org.junit.jupiter.api.RepeatedTest)1 Test (org.junit.jupiter.api.Test)1