Bugfix SQLITE_BUSY error

This commit is contained in:
GeorgH93 2017-09-12 18:44:41 +02:00
parent 55943e65f7
commit 8e0e866b4d
3 changed files with 6 additions and 5 deletions

2
.gitignore vendored
View File

@ -45,6 +45,8 @@ Network Trash Folder
Temporary Items Temporary Items
.apdisk .apdisk
# Temp files
*.tmp
# ========================= # =========================

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId> <groupId>at.pcgamingfreaks</groupId>
<artifactId>MinePacks</artifactId> <artifactId>MinePacks</artifactId>
<version>1.17.2</version> <version>1.17.3-SNAPSHOT</version>
<scm> <scm>
<connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection> <connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection>

View File

@ -70,6 +70,7 @@ protected HikariConfig getPoolConfig()
return null; return null;
} }
HikariConfig poolConfig = new HikariConfig(); HikariConfig poolConfig = new HikariConfig();
poolConfig.setMaximumPoolSize(1);
poolConfig.setJdbcUrl("jdbc:sqlite:" + plugin.getDataFolder().getAbsolutePath() + File.separator + "backpack.db"); poolConfig.setJdbcUrl("jdbc:sqlite:" + plugin.getDataFolder().getAbsolutePath() + File.separator + "backpack.db");
poolConfig.setConnectionTestQuery("SELECT 1;"); poolConfig.setConnectionTestQuery("SELECT 1;");
return poolConfig; return poolConfig;
@ -83,7 +84,7 @@ protected void updateQuerysForDialect()
queryInsertBP = queryInsertBP.replaceAll("\\) VALUES \\(\\?,\\?,\\?", "{FieldBPLastUpdate}) VALUES (?,?,?,DATE('now')"); queryInsertBP = queryInsertBP.replaceAll("\\) VALUES \\(\\?,\\?,\\?", "{FieldBPLastUpdate}) VALUES (?,?,?,DATE('now')");
} }
queryDeleteOldBackpacks = "DELETE FROM `{TableBackpacks}` WHERE `{FieldBPLastUpdate}` < DATE('now', '-{VarMaxAge} days')"; queryDeleteOldBackpacks = "DELETE FROM `{TableBackpacks}` WHERE `{FieldBPLastUpdate}` < DATE('now', '-{VarMaxAge} days')";
queryUpdateBP = queryUpdateBP.replaceAll("\\{NOW\\}", "DATE('now')"); queryUpdateBP = queryUpdateBP.replaceAll("\\{NOW}", "DATE('now')");
if(useUUIDs) if(useUUIDs)
{ {
queryUpdatePlayerAdd = "INSERT OR IGNORE INTO `{TablePlayers}` (`{FieldName}`,`{FieldUUID}`) VALUES (?,?);"; queryUpdatePlayerAdd = "INSERT OR IGNORE INTO `{TablePlayers}` (`{FieldName}`,`{FieldUUID}`) VALUES (?,?);";
@ -122,9 +123,7 @@ protected void checkDB()
rs.next(); rs.next();
stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `lastupdate` DATE DEFAULT '" + rs.getString(1) + "';"); stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `lastupdate` DATE DEFAULT '" + rs.getString(1) + "';");
} }
catch(SQLException ignored) catch(SQLException ignored) {}
{
}
} }
} }
catch(SQLException e) catch(SQLException e)