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,6 +217,7 @@ class Updater
} }
} }
for (final WorldConfig wcfg : getLoggedWorlds()) { for (final WorldConfig wcfg : getLoggedWorlds()) {
if (wcfg.isLogging(Logging.SIGNTEXT)) {
final ResultSet rs = st.executeQuery("SHOW FULL COLUMNS FROM `"+wcfg.table+"-sign` WHERE field = 'signtext'"); final ResultSet rs = st.executeQuery("SHOW FULL COLUMNS FROM `"+wcfg.table+"-sign` WHERE field = 'signtext'");
if (rs.next() && !rs.getString("Collation").substring(0,4).equalsIgnoreCase("utf8")) { if (rs.next() && !rs.getString("Collation").substring(0,4).equalsIgnoreCase("utf8")) {
st.execute("ALTER TABLE `"+wcfg.table+"-sign` CONVERT TO CHARSET utf8"); st.execute("ALTER TABLE `"+wcfg.table+"-sign` CONVERT TO CHARSET utf8");
@@ -225,6 +226,7 @@ class Updater
getLogger().info("Table "+wcfg.table+"-sign already fine, skipping it"); getLogger().info("Table "+wcfg.table+"-sign already fine, skipping it");
} }
} }
}
st.close(); st.close();
conn.close(); conn.close();
} catch (final SQLException ex) { } catch (final SQLException ex) {