mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-04 21:45:27 +02:00
fix probability being unbounded
This commit is contained in:
@@ -1037,13 +1037,13 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
try (Connection connection = getConnection(PoolIdentifier.MISC)) {
|
||||
if (!columnExists(connection, mcMMO.p.getGeneralConfig().getMySQLDatabaseName(), tablePrefix+tableName, columnName)) {
|
||||
try (Statement createStatement = connection.createStatement()) {
|
||||
logger.info("[SQLDB Check] Adding column '" + columnName + "' to table '" + tablePrefix + tableName + "'...");
|
||||
// logger.info("[SQLDB Check] Adding column '" + columnName + "' to table '" + tablePrefix + tableName + "'...");
|
||||
String startingLevel = "'" + mcMMO.p.getAdvancedConfig().getStartingLevel() + "'";
|
||||
createStatement.executeUpdate("ALTER TABLE `" + tablePrefix + tableName + "` "
|
||||
+ "ADD COLUMN `" + columnName + "` int(" + columnSize + ") unsigned NOT NULL DEFAULT " + startingLevel);
|
||||
}
|
||||
} else {
|
||||
logger.info("[SQLDB Check] Column '" + columnName + "' already exists in table '" + tablePrefix + tableName + "', looks good!");
|
||||
// logger.info("[SQLDB Check] Column '" + columnName + "' already exists in table '" + tablePrefix + tableName + "', looks good!");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace(); // Consider more robust logging
|
||||
@@ -1052,7 +1052,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
||||
}
|
||||
|
||||
private boolean columnExists(Connection connection, String database, String tableName, String columnName) throws SQLException {
|
||||
logger.info("[SQLDB Check] Checking if column '" + columnName + "' exists in table '" + tableName + "'");
|
||||
// logger.info("[SQLDB Check] Checking if column '" + columnName + "' exists in table '" + tableName + "'");
|
||||
try (Statement createStatement = connection.createStatement()) {
|
||||
String sql = "SELECT `COLUMN_NAME`\n" +
|
||||
"FROM `INFORMATION_SCHEMA`.`COLUMNS`\n" +
|
||||
|
Reference in New Issue
Block a user