diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/SQLDB.java b/Plan/common/src/main/java/com/djrapitops/plan/db/SQLDB.java index 8e5175022..35be23ea8 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/SQLDB.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/SQLDB.java @@ -27,7 +27,10 @@ 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.CreateTablesTransaction; import com.djrapitops.plan.db.patches.*; -import com.djrapitops.plan.db.sql.tables.*; +import com.djrapitops.plan.db.sql.tables.SessionsTable; +import com.djrapitops.plan.db.sql.tables.TPSTable; +import com.djrapitops.plan.db.sql.tables.UserInfoTable; +import com.djrapitops.plan.db.sql.tables.UsersTable; import com.djrapitops.plan.db.tasks.PatchTask; import com.djrapitops.plan.system.database.databases.operation.FetchOperations; import com.djrapitops.plan.system.database.databases.operation.SaveOperations; @@ -78,7 +81,6 @@ public abstract class SQLDB extends AbstractDatabase { private final UserInfoTable userInfoTable; private final SessionsTable sessionsTable; private final TPSTable tpsTable; - private final ServerTable serverTable; private final SQLFetchOps fetchOps; private final SQLSearchOps searchOps; @@ -104,8 +106,6 @@ public abstract class SQLDB extends AbstractDatabase { this.timings = timings; this.errorHandler = errorHandler; - serverTable = new ServerTable(this); - tpsTable = new TPSTable(this); usersTable = new UsersTable(this); @@ -349,11 +349,6 @@ public abstract class SQLDB extends AbstractDatabase { return tpsTable; } - @Deprecated - public ServerTable getServerTable() { - return serverTable; - } - @Deprecated public UserInfoTable getUserInfoTable() { return userInfoTable; diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ServerTable.java b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ServerTable.java index 361fac8a7..a9a774842 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ServerTable.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/sql/tables/ServerTable.java @@ -17,19 +17,21 @@ package com.djrapitops.plan.db.sql.tables; import com.djrapitops.plan.db.DBType; -import com.djrapitops.plan.db.SQLDB; -import com.djrapitops.plan.db.sql.parsing.*; +import com.djrapitops.plan.db.sql.parsing.CreateTableParser; +import com.djrapitops.plan.db.sql.parsing.Insert; +import com.djrapitops.plan.db.sql.parsing.Sql; +import com.djrapitops.plan.db.sql.parsing.Update; import com.djrapitops.plan.system.info.server.Server; +import static com.djrapitops.plan.db.sql.parsing.Sql.*; + /** - * Table for managing multiple server's data in the database. - *
- * Table Name: plan_servers
+ * Table information about 'plan_servers'.
*
* @author Rsl1122
* @see Server
*/
-public class ServerTable extends Table {
+public class ServerTable {
public static final String TABLE_NAME = "plan_servers";
@@ -54,17 +56,15 @@ public class ServerTable extends Table {
.toString();
public static final String STATEMENT_SELECT_SERVER_ID =
- "(SELECT " + TABLE_NAME + "." + SERVER_ID + " FROM " + TABLE_NAME +
- " WHERE " + TABLE_NAME + "." + SERVER_UUID + "=?" +
+ "(" + SELECT + TABLE_NAME + "." + SERVER_ID +
+ FROM + TABLE_NAME +
+ WHERE + TABLE_NAME + "." + SERVER_UUID + "=?" +
" LIMIT 1)";
- public ServerTable(SQLDB db) {
- super(TABLE_NAME, db);
- statementSelectServerID = "(" + Select.from(tableName, tableName + "." + SERVER_ID).where(tableName + "." + SERVER_UUID + "=?").toString() + " LIMIT 1)";
+ private ServerTable() {
+ /* Static information class */
}
- public final String statementSelectServerID;
-
public static String createTableSQL(DBType dbType) {
return CreateTableParser.create(TABLE_NAME, dbType)
.column(SERVER_ID, Sql.INT).primaryKey()
diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLOps.java b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLOps.java
index a2f5cd55f..4b642535a 100644
--- a/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLOps.java
+++ b/Plan/common/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLOps.java
@@ -17,7 +17,10 @@
package com.djrapitops.plan.system.database.databases.sql.operation;
import com.djrapitops.plan.db.SQLDB;
-import com.djrapitops.plan.db.sql.tables.*;
+import com.djrapitops.plan.db.sql.tables.SessionsTable;
+import com.djrapitops.plan.db.sql.tables.TPSTable;
+import com.djrapitops.plan.db.sql.tables.UserInfoTable;
+import com.djrapitops.plan.db.sql.tables.UsersTable;
@Deprecated
public class SQLOps {
@@ -28,7 +31,6 @@ public class SQLOps {
protected final UserInfoTable userInfoTable;
protected final SessionsTable sessionsTable;
protected final TPSTable tpsTable;
- protected final ServerTable serverTable;
public SQLOps(SQLDB db) {
this.db = db;
@@ -37,6 +39,5 @@ public class SQLOps {
userInfoTable = db.getUserInfoTable();
sessionsTable = db.getSessionsTable();
tpsTable = db.getTpsTable();
- serverTable = db.getServerTable();
}
}
diff --git a/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java b/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java
index 36c5de4dd..5cbb39afc 100644
--- a/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java
+++ b/Plan/common/src/test/java/com/djrapitops/plan/db/SQLiteTest.java
@@ -22,7 +22,6 @@ import com.djrapitops.plan.db.access.queries.ServerAggregateQueries;
import com.djrapitops.plan.db.access.queries.objects.ServerQueries;
import com.djrapitops.plan.db.access.transactions.StoreServerInformationTransaction;
import com.djrapitops.plan.db.access.transactions.events.PlayerRegisterTransaction;
-import com.djrapitops.plan.db.sql.tables.ServerTable;
import com.djrapitops.plan.system.info.server.Server;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -60,8 +59,6 @@ public class SQLiteTest extends CommonDBTest {
@Test
public void testServerTableBungeeSave() throws DBInitException {
- ServerTable serverTable = db.getServerTable();
-
Optional