Merge pull request #187 from ammaraskar/updater

stop hardcoding table names :(
This commit is contained in:
md-5
2012-08-10 14:03:32 -07:00

View File

@@ -202,11 +202,13 @@ class Updater
final Connection conn = logblock.getConnection(); final Connection conn = logblock.getConnection();
try { try {
conn.setAutoCommit(true); conn.setAutoCommit(true);
final Statement st = conn.createStatement(); for (final WorldConfig wcfg : getLoggedWorlds()) {
st.execute("ALTER TABLE `lb-world` MODIFY x MEDIUMINT NOT NULL"); final Statement st = conn.createStatement();
st.execute("ALTER TABLE `lb-world` MODIFY y SMALLINT NOT NULL"); st.execute("ALTER TABLE `" + wcfg.table + "` MODIFY x MEDIUMINT NOT NULL");
st.execute("ALTER TABLE `lb-world` MODIFY z MEDIUMINT NOT NULL"); st.execute("ALTER TABLE `" + wcfg.table + "` MODIFY y SMALLINT NOT NULL");
st.close(); st.execute("ALTER TABLE `" + wcfg.table + "` MODIFY z MEDIUMINT NOT NULL");
st.close();
}
conn.close(); conn.close();
} catch (final SQLException ex) { } catch (final SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "[LogBlock Updater] Error: ", ex); Bukkit.getLogger().log(Level.SEVERE, "[LogBlock Updater] Error: ", ex);