cleanup databaseHelper

Former-commit-id: e97f51856c856d5a7b987b353cce94fd17080318 [formerly 1b9c0b67f909c49db664c15f59aeb997cb53d882]
Former-commit-id: f22f32741235357d0121fb36a4a3c1d4f552ad68
This commit is contained in:
Ghost_chu committed 2018-12-04 14:47:49 +08:00
1 parent 6e0259ad6b
commit ca81daa4cc
3 files changed
+8 -16

No files matched your search

@@ -51,11 +51,7 @@ public class DatabaseHelper {
public static void createShopsTable(Database db) throws SQLException {
Statement st = db.getConnection().createStatement();
String createTable = null;
if(QuickShop.instance.getConfig().getBoolean("database.use-varchar")) {
createTable = "CREATE TABLE "+QuickShop.instance.dbPrefix+"shops (owner VARCHAR(255) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARSET utf8 NOT NULL, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(32) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );";
}else {
createTable = "CREATE TABLE "+QuickShop.instance.dbPrefix+"shops (owner TEXT(32) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARSET utf8 NOT NULL, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(32) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );";
}
createTable = "CREATE TABLE "+QuickShop.instance.dbPrefix+"shops (owner VARCHAR(255) NOT NULL, price double(32, 2) NOT NULL, itemConfig TEXT CHARSET utf8 NOT NULL, x INTEGER(32) NOT NULL, y INTEGER(32) NOT NULL, z INTEGER(32) NOT NULL, world VARCHAR(32) NOT NULL, unlimited boolean, type boolean, PRIMARY KEY (x, y, z, world) );";
st.execute(createTable);
}
@@ -68,19 +64,16 @@ public class DatabaseHelper {
public static void createMessagesTable(Database db) throws SQLException {
Statement st = db.getConnection().createStatement();
String createTable = null;
if(QuickShop.instance.getConfig().getBoolean("database.use-varchar")) {
createTable = "CREATE TABLE "+QuickShop.instance.dbPrefix+"messages (owner VARCHAR(255) NOT NULL, message TEXT(25) NOT NULL, time BIGINT(32) NOT NULL );";
}else {
createTable = "CREATE TABLE "+QuickShop.instance.dbPrefix+"messages (owner TEXT(32) NOT NULL, message TEXT(25) NOT NULL, time BIGINT(32) NOT NULL );";
}
st.execute(createTable);
}
public static ResultSet selectAllShops(Database db) throws SQLException {
PreparedStatement ps = db.getConnection().prepareStatement("SELECT * FROM "+QuickShop.instance.dbPrefix+"shops");
PreparedStatement ps = db.getConnection()
.prepareStatement("SELECT * FROM " + QuickShop.instance.dbPrefix + "shops");
return ps.executeQuery();
}
public static ResultSet selectAllMessages(Database db) throws SQLException {
PreparedStatement ps = db.getConnection().prepareStatement("SELECT * FROM "+QuickShop.instance.dbPrefix+"messages");
@@ -703,6 +703,9 @@ public class QuickShop extends JavaPlugin {
if (selectedVersion == 12) {
getConfig().set("plugin.ProtocolLib",null); //Removed
getConfig().set("plugin.BKCommonLib",null); //Removed
getConfig().set("plugin.BKCommonLib",null); //Removed
getConfig().set("database.use-varchar",null); //Removed
getConfig().set("database.reconnect",null); //Removed
getConfig().set("config-version", 13);
selectedVersion = 13;
saveConfig();
+1 -5
View File
@@ -202,11 +202,7 @@ float:
# Enable or disable plugin support.
plugin:
#If you have ProtocolLib, QSRR will enable Sign Input GUI not normal chat
ProtocolLib: true
#If you have Multiverse-Core, QSRR will try load world when shop's world not exist and throw out exception auto repair the shop.
Multiverse-Core: true
#If you have OpenInv, QSRR will enable EnderChest feature.
OpenInv: true
#If you have BKCommonLib, QSRR will enable advanced display-item protection.
BKCommonLib: true
OpenInv: true