TPSTable now static information class:

- Made constructor private
- Removed getter in SQLDB
This commit is contained in:
Rsl1122 2019-02-16 14:10:46 +02:00
parent ba41952bee
commit 463f56f340
4 changed files with 5 additions and 24 deletions

View File

@ -27,7 +27,6 @@ import com.djrapitops.plan.db.access.transactions.init.CleanTransaction;
import com.djrapitops.plan.db.access.transactions.init.CreateIndexTransaction; import com.djrapitops.plan.db.access.transactions.init.CreateIndexTransaction;
import com.djrapitops.plan.db.access.transactions.init.CreateTablesTransaction; import com.djrapitops.plan.db.access.transactions.init.CreateTablesTransaction;
import com.djrapitops.plan.db.patches.*; import com.djrapitops.plan.db.patches.*;
import com.djrapitops.plan.db.sql.tables.TPSTable;
import com.djrapitops.plan.db.tasks.PatchTask; import com.djrapitops.plan.db.tasks.PatchTask;
import com.djrapitops.plan.system.database.databases.operation.FetchOperations; import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
import com.djrapitops.plan.system.database.databases.sql.operation.SQLFetchOps; import com.djrapitops.plan.system.database.databases.sql.operation.SQLFetchOps;
@ -70,8 +69,6 @@ public abstract class SQLDB extends AbstractDatabase {
protected final Timings timings; protected final Timings timings;
protected final ErrorHandler errorHandler; protected final ErrorHandler errorHandler;
private final TPSTable tpsTable;
private final SQLFetchOps fetchOps; private final SQLFetchOps fetchOps;
private PluginTask dbCleanTask; private PluginTask dbCleanTask;
@ -94,8 +91,6 @@ public abstract class SQLDB extends AbstractDatabase {
this.timings = timings; this.timings = timings;
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
tpsTable = new TPSTable(this);
fetchOps = new SQLFetchOps(this); fetchOps = new SQLFetchOps(this);
} }
@ -316,11 +311,6 @@ public abstract class SQLDB extends AbstractDatabase {
transaction.executeTransaction(this); transaction.executeTransaction(this);
} }
@Deprecated
public TPSTable getTpsTable() {
return tpsTable;
}
@Override @Override
@Deprecated @Deprecated
public FetchOperations fetch() { public FetchOperations fetch() {

View File

@ -126,9 +126,8 @@ public class Version10Patch extends Patch {
private void copyTPS() { private void copyTPS() {
String tempTableName = "temp_tps"; String tempTableName = "temp_tps";
TPSTable tpsTable = db.getTpsTable();
renameTable(tpsTable.toString(), tempTableName); renameTable(TPSTable.TABLE_NAME, tempTableName);
execute(TPSTable.createTableSQL(dbType)); execute(TPSTable.createTableSQL(dbType));

View File

@ -17,18 +17,15 @@
package com.djrapitops.plan.db.sql.tables; package com.djrapitops.plan.db.sql.tables;
import com.djrapitops.plan.db.DBType; import com.djrapitops.plan.db.DBType;
import com.djrapitops.plan.db.SQLDB;
import com.djrapitops.plan.db.sql.parsing.CreateTableParser; import com.djrapitops.plan.db.sql.parsing.CreateTableParser;
import com.djrapitops.plan.db.sql.parsing.Sql; import com.djrapitops.plan.db.sql.parsing.Sql;
/** /**
* Table that is in charge of storing TPS, Players Online and Performance data. * Table information about 'plan_tps'.
* <p>
* Table Name: plan_tps
* *
* @author Rsl1122 * @author Rsl1122
*/ */
public class TPSTable extends Table { public class TPSTable {
public static final String TABLE_NAME = "plan_tps"; public static final String TABLE_NAME = "plan_tps";
@ -56,8 +53,8 @@ public class TPSTable extends Table {
+ ServerTable.STATEMENT_SELECT_SERVER_ID + ", " + ServerTable.STATEMENT_SELECT_SERVER_ID + ", "
+ "?, ?, ?, ?, ?, ?, ?, ?)"; + "?, ?, ?, ?, ?, ?, ?, ?)";
public TPSTable(SQLDB db) { private TPSTable() {
super(TABLE_NAME, db); /* Static information class */
} }
public static String createTableSQL(DBType dbType) { public static String createTableSQL(DBType dbType) {

View File

@ -17,18 +17,13 @@
package com.djrapitops.plan.system.database.databases.sql.operation; package com.djrapitops.plan.system.database.databases.sql.operation;
import com.djrapitops.plan.db.SQLDB; import com.djrapitops.plan.db.SQLDB;
import com.djrapitops.plan.db.sql.tables.TPSTable;
@Deprecated @Deprecated
public class SQLOps { public class SQLOps {
protected final SQLDB db; protected final SQLDB db;
protected final TPSTable tpsTable;
public SQLOps(SQLDB db) { public SQLOps(SQLDB db) {
this.db = db; this.db = db;
tpsTable = db.getTpsTable();
} }
} }