Check sign text is being logged before attempting to update table

This commit is contained in:
Philip Cass
2013-12-04 09:45:38 +00:00
parent d055d2af86
commit d50c48f79d

View File

@@ -217,12 +217,14 @@ class Updater
} }
} }
for (final WorldConfig wcfg : getLoggedWorlds()) { for (final WorldConfig wcfg : getLoggedWorlds()) {
final ResultSet rs = st.executeQuery("SHOW FULL COLUMNS FROM `"+wcfg.table+"-sign` WHERE field = 'signtext'"); if (wcfg.isLogging(Logging.SIGNTEXT)) {
if (rs.next() && !rs.getString("Collation").substring(0,4).equalsIgnoreCase("utf8")) { final ResultSet rs = st.executeQuery("SHOW FULL COLUMNS FROM `"+wcfg.table+"-sign` WHERE field = 'signtext'");
st.execute("ALTER TABLE `"+wcfg.table+"-sign` CONVERT TO CHARSET utf8"); if (rs.next() && !rs.getString("Collation").substring(0,4).equalsIgnoreCase("utf8")) {
getLogger().info("Table "+wcfg.table+"-sign modified"); st.execute("ALTER TABLE `"+wcfg.table+"-sign` CONVERT TO CHARSET utf8");
} else { getLogger().info("Table "+wcfg.table+"-sign modified");
getLogger().info("Table "+wcfg.table+"-sign already fine, skipping it"); } else {
getLogger().info("Table "+wcfg.table+"-sign already fine, skipping it");
}
} }
} }
st.close(); st.close();