diff --git a/src/fluddokt/opsu/fake/GameOpsu.java b/src/fluddokt/opsu/fake/GameOpsu.java index 75069a3a..14ddfc32 100644 --- a/src/fluddokt/opsu/fake/GameOpsu.java +++ b/src/fluddokt/opsu/fake/GameOpsu.java @@ -23,7 +23,7 @@ public class GameOpsu extends com.badlogic.gdx.Game { - public final static String VERSION = "0.15.0a"; + public final static String VERSION = "0.15.0b"; public StateBasedGame sbg; Stage stage; diff --git a/src/itdelatrisu/opsu/db/BeatmapDB.java b/src/itdelatrisu/opsu/db/BeatmapDB.java index 5e83d5d6..ee8e3c76 100644 --- a/src/itdelatrisu/opsu/db/BeatmapDB.java +++ b/src/itdelatrisu/opsu/db/BeatmapDB.java @@ -17,15 +17,15 @@ */ package itdelatrisu.opsu.db; +import fluddokt.opsu.fake.*; +import itdelatrisu.opsu.Utils; +import java.io.IOException; import itdelatrisu.opsu.ErrorHandler; -import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.beatmap.BeatmapParser; import itdelatrisu.opsu.options.Options; - -import java.io.IOException; //import java.io.File; import java.sql.Connection; import java.sql.PreparedStatement; @@ -37,10 +37,9 @@ import java.util.List; import java.util.Map; -//import org.newdawn.slick.util.Log; - - -import fluddokt.opsu.fake.*; +/* +import org.newdawn.slick.util.Log; +*/ /** * Handles connections and queries with the cached beatmap database. @@ -208,16 +207,16 @@ private static void createDatabase() { "md5hash TEXT, stars REAL, " + "dateAdded INTEGER, favorite BOOLEAN, playCount INTEGER, lastPlayed INTEGER, localOffset INTEGER, " + "video TEXT, videoOffset INTEGER" + - ");\n" + + "); " + "CREATE TABLE IF NOT EXISTS info (" + "key TEXT NOT NULL UNIQUE, value TEXT" + - ");\n" + - "CREATE INDEX IF NOT EXISTS idx ON beatmaps (dir, file);\n" + + "); " + + "CREATE INDEX IF NOT EXISTS idx ON beatmaps (dir, file); " + // extra optimizations - "PRAGMA locking_mode = EXCLUSIVE;\n" + + "PRAGMA locking_mode = EXCLUSIVE; " + "PRAGMA journal_mode = WAL;"; - for (String sqlStmt : sql.split(";\n")){ + for (String sqlStmt : sql.split(";")){ System.out.println("OsuDB SQLExec :"+sqlStmt+" "+stmt.execute(sqlStmt)); } diff --git a/src/itdelatrisu/opsu/db/ScoreDB.java b/src/itdelatrisu/opsu/db/ScoreDB.java index 6a715ce6..388d5812 100644 --- a/src/itdelatrisu/opsu/db/ScoreDB.java +++ b/src/itdelatrisu/opsu/db/ScoreDB.java @@ -17,21 +17,21 @@ */ package itdelatrisu.opsu.db; +import fluddokt.opsu.fake.Log; +import itdelatrisu.opsu.Utils; +import java.io.IOException; import itdelatrisu.opsu.ErrorHandler; import itdelatrisu.opsu.ScoreData; -import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.beatmap.Beatmap; import itdelatrisu.opsu.options.Options; import itdelatrisu.opsu.user.User; import itdelatrisu.opsu.user.UserList; -import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.SQLWarning; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; @@ -107,7 +107,6 @@ public static void init() { if (connection == null) return; - // run any database updates updateDatabase(); @@ -168,7 +167,7 @@ private static void createDatabase() { "mods INTEGER, " + "replay TEXT, " + "playerName TEXT"+ - ");\n" + + ");" + "CREATE TABLE IF NOT EXISTS users (" + "name TEXT NOT NULL UNIQUE, " + "score INTEGER, accuracy REAL, " + @@ -177,9 +176,9 @@ private static void createDatabase() { ");" + "CREATE TABLE IF NOT EXISTS info (" + "key TEXT NOT NULL UNIQUE, value TEXT" + - ");\n " + + "); " + "CREATE INDEX IF NOT EXISTS idx ON scores (MID, MSID, title, artist, creator, version);"; - for (String sqlStmt : sql.split(";\n")){ + for (String sqlStmt : sql.split(";")){ System.out.println("ScoreDB SQLExec :"+sqlStmt+" "+stmt.execute(sqlStmt)); //stmt.e } @@ -231,7 +230,11 @@ private static void updateDatabase() { // apply updates for (String query : getUpdateQueries(version)) + try { stmt.executeUpdate(query); + } catch (SQLException e) { + Log.warn("Failed to update score database.", e); + } // update version if (infoExists) {