New updater notification and minor OsuDB fix.
- A bar notification is now shown after opsu! updates. - Insert the current database version into the beatmap cache upon creation (fixes the initial version check) and only update the version if necessary. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -127,6 +127,10 @@ public class OsuDB {
|
||||
"PRAGMA locking_mode = EXCLUSIVE; " +
|
||||
"PRAGMA journal_mode = WAL;";
|
||||
stmt.executeUpdate(sql);
|
||||
|
||||
// set the version key, if empty
|
||||
sql = String.format("INSERT OR IGNORE INTO info(key, value) VALUES('version', '%s')", DATABASE_VERSION);
|
||||
stmt.executeUpdate(sql);
|
||||
} catch (SQLException e) {
|
||||
ErrorHandler.error("Could not create beatmap database.", e, true);
|
||||
}
|
||||
@@ -145,14 +149,15 @@ public class OsuDB {
|
||||
rs.close();
|
||||
|
||||
// if different from current version, clear the database
|
||||
if (!version.equals(DATABASE_VERSION))
|
||||
if (!version.equals(DATABASE_VERSION)) {
|
||||
clearDatabase();
|
||||
|
||||
// update version
|
||||
PreparedStatement ps = connection.prepareStatement("REPLACE INTO info (key, value) VALUES ('version', ?)");
|
||||
ps.setString(1, DATABASE_VERSION);
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
// update version
|
||||
PreparedStatement ps = connection.prepareStatement("REPLACE INTO info (key, value) VALUES ('version', ?)");
|
||||
ps.setString(1, DATABASE_VERSION);
|
||||
ps.executeUpdate();
|
||||
ps.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
ErrorHandler.error("Beatmap database version checks failed.", e, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user