use of com.djrapitops.plan.storage.database.queries.schema.SessionIDServerIDRelationQuery in project Plan by plan-player-analytics.
the class KillsServerIDPatch method applyPatch.
@Override
protected void applyPatch() {
if (hasColumn(KillsTable.TABLE_NAME, KillsTable.SERVER_UUID)) {
return;
}
addColumn(KillsTable.TABLE_NAME, "server_id integer NOT NULL DEFAULT 0");
Map<Integer, Integer> sessionIDServerIDRelation = query(new SessionIDServerIDRelationQuery());
String sql = "UPDATE " + KillsTable.TABLE_NAME + " SET server_id=? WHERE " + KillsTable.SESSION_ID + "=?";
execute(new ExecBatchStatement(sql) {
@Override
public void prepare(PreparedStatement statement) throws SQLException {
for (Map.Entry<Integer, Integer> entry : sessionIDServerIDRelation.entrySet()) {
Integer sessionID = entry.getKey();
Integer serverID = entry.getValue();
statement.setInt(1, serverID);
statement.setInt(2, sessionID);
statement.addBatch();
}
}
});
}
use of com.djrapitops.plan.storage.database.queries.schema.SessionIDServerIDRelationQuery in project Plan by plan-player-analytics.
the class WorldTimesSeverIDPatch method applyPatch.
@Override
protected void applyPatch() {
Map<Integer, Integer> sessionIDServerIDRelation = query(new SessionIDServerIDRelationQuery());
String sql = "UPDATE " + WorldTimesTable.TABLE_NAME + " SET " + "server_id=?" + WHERE + WorldTimesTable.SESSION_ID + "=?";
execute(new ExecBatchStatement(sql) {
@Override
public void prepare(PreparedStatement statement) throws SQLException {
for (Map.Entry<Integer, Integer> entry : sessionIDServerIDRelation.entrySet()) {
Integer sessionID = entry.getKey();
Integer serverID = entry.getValue();
statement.setInt(1, serverID);
statement.setInt(2, sessionID);
statement.addBatch();
}
}
});
}
Aggregations