mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-12 14:58:26 +02:00
Fixed Commit issue with MySQL
This commit is contained in:
parent
7321ce0007
commit
94ed7e09a6
@ -85,7 +85,7 @@ public class ActionsTable extends UserIDTable {
|
||||
statement.setString(5, action.getAdditionalInfo());
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement, connection);
|
||||
}
|
||||
@ -198,7 +198,7 @@ public class ActionsTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement, connection);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class CommandUseTable extends Table {
|
||||
statement.setString(2, command);
|
||||
int success = statement.executeUpdate();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
|
||||
if (success == 0) {
|
||||
insertCommand(command);
|
||||
@ -139,7 +139,7 @@ public class CommandUseTable extends Table {
|
||||
statement.setString(3, Plan.getServerUUID().toString());
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement, connection);
|
||||
}
|
||||
@ -239,7 +239,7 @@ public class CommandUseTable extends Table {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class IPsTable extends UserIDTable {
|
||||
statement.setString(3, geolocation);
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -216,7 +216,7 @@ public class IPsTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class KillsTable extends UserIDTable {
|
||||
statement.setString(2, uuid.toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -104,7 +104,7 @@ public class KillsTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -231,7 +231,7 @@ public class KillsTable extends UserIDTable {
|
||||
}
|
||||
}
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class NicknamesTable extends UserIDTable {
|
||||
statement.setString(3, displayName);
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -223,7 +223,7 @@ public class NicknamesTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class SecurityTable extends Table {
|
||||
statement.setString(1, user);
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
Log.toLog(this.getClass().getName(), ex);
|
||||
@ -80,7 +80,7 @@ public class SecurityTable extends Table {
|
||||
statement.setInt(3, permLevel);
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class SecurityTable extends Table {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class ServerTable extends Table {
|
||||
statement.setInt(6, info.getId());
|
||||
statement.executeUpdate();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -126,7 +126,7 @@ public class ServerTable extends Table {
|
||||
statement.setInt(5, info.getMaxPlayers());
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -293,7 +293,7 @@ public class ServerTable extends Table {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class SessionsTable extends UserIDTable {
|
||||
statement.setString(6, Plan.getServerUUID().toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -621,7 +621,7 @@ public class SessionsTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class TPSTable extends Table {
|
||||
statement.setDouble(8, tps.getChunksLoaded());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class TPSTable extends Table {
|
||||
statement.setLong(2, MiscUtils.getTime() - fiveWeeks);
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -266,7 +266,7 @@ public class TPSTable extends Table {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public abstract class Table {
|
||||
try (Connection connection = getConnection()){
|
||||
statement = connection.createStatement();
|
||||
boolean b = statement.execute(statementString);
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
return b;
|
||||
} finally {
|
||||
close(statement);
|
||||
@ -173,6 +173,10 @@ public abstract class Table {
|
||||
Objects.equal(db, table.db);
|
||||
}
|
||||
|
||||
protected void commit(Connection connection) throws SQLException {
|
||||
db.commit(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(tableName, db, usingMySQL);
|
||||
|
@ -31,7 +31,7 @@ public abstract class UserIDTable extends Table {
|
||||
statement.setString(1, uuid.toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class UserInfoTable extends UserIDTable {
|
||||
statement.setString(3, Plan.getServerUUID().toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class UserInfoTable extends UserIDTable {
|
||||
statement.setString(3, uuid.toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -269,7 +269,7 @@ public class UserInfoTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class UsersTable extends UserIDTable {
|
||||
statement.setString(1, uuid.toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -170,7 +170,7 @@ public class UsersTable extends UserIDTable {
|
||||
statement.setString(3, name);
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -201,7 +201,7 @@ public class UsersTable extends UserIDTable {
|
||||
statement.setString(2, uuid.toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -234,7 +234,7 @@ public class UsersTable extends UserIDTable {
|
||||
statement.setString(1, uuid.toString());
|
||||
|
||||
statement.execute();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -328,7 +328,7 @@ public class UsersTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -373,7 +373,7 @@ public class UsersTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class VersionTable extends Table {
|
||||
statement = connection.prepareStatement("INSERT INTO " + tableName + " (version) VALUES (" + version + ")");
|
||||
|
||||
statement.executeUpdate();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class WorldTable extends Table {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class WorldTimesTable extends UserIDTable {
|
||||
}
|
||||
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -303,7 +303,7 @@ public class WorldTimesTable extends UserIDTable {
|
||||
}
|
||||
}
|
||||
statement.executeBatch();
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class ProtocolTable extends Table {
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class ProtocolTable extends Table {
|
||||
statement.setInt(2, version);
|
||||
statement.execute();
|
||||
|
||||
connection.commit();
|
||||
commit(connection);
|
||||
} finally {
|
||||
close(statement);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user