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
.apdisk
# Temp files
*.tmp
# =========================

View File

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

View File

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