Reliability/scale improvements for database mode.
This commit is contained in:
parent
9648c18571
commit
f45fdb70d3
|
|
@ -79,12 +79,17 @@ public class DatabaseDataStore extends DataStore
|
||||||
|
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_nextclaimid (nextid INT(15));");
|
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_nextclaimid (nextid INT(15));");
|
||||||
|
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_claimdata (id INT(15), owner VARCHAR(50), lessercorner VARCHAR(100), greatercorner VARCHAR(100), builders VARCHAR(1000), containers VARCHAR(1000), accessors VARCHAR(1000), managers VARCHAR(1000), parentid INT(15));");
|
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_claimdata (id INT(15), owner VARCHAR(50), lessercorner VARCHAR(100), greatercorner VARCHAR(100), builders VARCHAR(65000), containers VARCHAR(65000), accessors VARCHAR(65000), managers VARCHAR(65000), parentid INT(15));");
|
||||||
|
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_playerdata (name VARCHAR(50), lastlogin DATETIME, accruedblocks INT(15), bonusblocks INT(15));");
|
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_playerdata (name VARCHAR(50), lastlogin DATETIME, accruedblocks INT(15), bonusblocks INT(15));");
|
||||||
|
|
||||||
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_schemaversion (version INT(15));");
|
statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_schemaversion (version INT(15));");
|
||||||
|
|
||||||
|
statement.execute("ALTER TABLE griefprevention_claimdata MODIFY builders VARCHAR(65000);");
|
||||||
|
statement.execute("ALTER TABLE griefprevention_claimdata MODIFY containers VARCHAR(65000);");
|
||||||
|
statement.execute("ALTER TABLE griefprevention_claimdata MODIFY accessors VARCHAR(65000);");
|
||||||
|
statement.execute("ALTER TABLE griefprevention_claimdata MODIFY managers VARCHAR(65000);");
|
||||||
|
|
||||||
//if the next claim id table is empty, this is a brand new database which will write using the latest schema
|
//if the next claim id table is empty, this is a brand new database which will write using the latest schema
|
||||||
//otherwise, schema version is determined by schemaversion table (or =0 if table is empty, see getSchemaVersion())
|
//otherwise, schema version is determined by schemaversion table (or =0 if table is empty, see getSchemaVersion())
|
||||||
ResultSet results = statement.executeQuery("SELECT * FROM griefprevention_nextclaimid;");
|
ResultSet results = statement.executeQuery("SELECT * FROM griefprevention_nextclaimid;");
|
||||||
|
|
@ -615,7 +620,12 @@ public class DatabaseDataStore extends DataStore
|
||||||
{
|
{
|
||||||
if(this.databaseConnection == null || !this.databaseConnection.isValid(3))
|
if(this.databaseConnection == null || !this.databaseConnection.isValid(3))
|
||||||
{
|
{
|
||||||
//set username/pass properties
|
if(this.databaseConnection != null && !this.databaseConnection.isClosed())
|
||||||
|
{
|
||||||
|
this.databaseConnection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//set username/pass properties
|
||||||
Properties connectionProps = new Properties();
|
Properties connectionProps = new Properties();
|
||||||
connectionProps.put("user", this.userName);
|
connectionProps.put("user", this.userName);
|
||||||
connectionProps.put("password", this.password);
|
connectionProps.put("password", this.password);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user