Replay importing
This commit is contained in:
@@ -43,7 +43,7 @@ public class OsuDB {
|
||||
* Current database version.
|
||||
* This value should be changed whenever the database format changes.
|
||||
*/
|
||||
private static final String DATABASE_VERSION = "2014-03-08";
|
||||
private static final String DATABASE_VERSION = "2015-03-30";
|
||||
|
||||
/** Minimum batch size ratio ({@code batchSize/cacheSize}) to invoke batch loading. */
|
||||
private static final float LOAD_BATCH_MIN_RATIO = 0.2f;
|
||||
@@ -83,7 +83,7 @@ public class OsuDB {
|
||||
insertStmt = connection.prepareStatement(
|
||||
"INSERT INTO beatmaps VALUES (" +
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " +
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
selectStmt = connection.prepareStatement("SELECT * FROM beatmaps WHERE dir = ? AND file = ?");
|
||||
deleteMapStmt = connection.prepareStatement("DELETE FROM beatmaps WHERE dir = ? AND file = ?");
|
||||
@@ -116,7 +116,8 @@ public class OsuDB {
|
||||
"bpmMin INTEGER, bpmMax INTEGER, endTime INTEGER, " +
|
||||
"audioFile TEXT, audioLeadIn INTEGER, previewTime INTEGER, countdown INTEGER, sampleSet TEXT, stackLeniency REAL, " +
|
||||
"mode INTEGER, letterboxInBreaks BOOLEAN, widescreenStoryboard BOOLEAN, epilepsyWarning BOOLEAN, " +
|
||||
"bg TEXT, timingPoints TEXT, breaks TEXT, combo TEXT" +
|
||||
"bg TEXT, timingPoints TEXT, breaks TEXT, combo TEXT," +
|
||||
"md5hash TEXT" +
|
||||
"); " +
|
||||
"CREATE TABLE IF NOT EXISTS info (" +
|
||||
"key TEXT NOT NULL UNIQUE, value TEXT" +
|
||||
@@ -333,7 +334,8 @@ public class OsuDB {
|
||||
stmt.setString(37, osu.timingPointsToString());
|
||||
stmt.setString(38, osu.breaksToString());
|
||||
stmt.setString(39, osu.comboToString());
|
||||
} catch (SQLException e) {
|
||||
stmt.setString(40, osu.md5Hash);
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new SQLException(e);
|
||||
@@ -470,6 +472,7 @@ public class OsuDB {
|
||||
osu.widescreenStoryboard = rs.getBoolean(34);
|
||||
osu.epilepsyWarning = rs.getBoolean(35);
|
||||
osu.bg = OsuParser.getDBString(rs.getString(36));
|
||||
osu.md5Hash = OsuParser.getDBString(rs.getString(40));
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ScoreDB {
|
||||
* This value should be changed whenever the database format changes.
|
||||
* Add any update queries to the {@link #getUpdateQueries(int)} method.
|
||||
*/
|
||||
private static final int DATABASE_VERSION = 20140311;
|
||||
private static final int DATABASE_VERSION = 20150401;
|
||||
|
||||
/**
|
||||
* Returns a list of SQL queries to apply, in order, to update from
|
||||
@@ -57,6 +57,8 @@ public class ScoreDB {
|
||||
List<String> list = new LinkedList<String>();
|
||||
if (version < 20140311)
|
||||
list.add("ALTER TABLE scores ADD COLUMN replay TEXT");
|
||||
if (version < 20150401)
|
||||
list.add("ALTER TABLE scores ADD COLUMN playerName TEXT");
|
||||
|
||||
/* add future updates here */
|
||||
|
||||
@@ -96,7 +98,7 @@ public class ScoreDB {
|
||||
// prepare sql statements
|
||||
try {
|
||||
insertStmt = connection.prepareStatement(
|
||||
"INSERT INTO scores VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
"INSERT OR IGNORE INTO scores VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
selectMapStmt = connection.prepareStatement(
|
||||
"SELECT * FROM scores WHERE " +
|
||||
@@ -137,7 +139,8 @@ public class ScoreDB {
|
||||
"combo INTEGER, " +
|
||||
"perfect BOOLEAN, " +
|
||||
"mods INTEGER, " +
|
||||
"replay TEXT" +
|
||||
"replay TEXT," +
|
||||
"playerName TEXT"+
|
||||
");" +
|
||||
"CREATE TABLE IF NOT EXISTS info (" +
|
||||
"key TEXT NOT NULL UNIQUE, value TEXT" +
|
||||
@@ -283,6 +286,8 @@ public class ScoreDB {
|
||||
stmt.setInt(15, data.combo);
|
||||
stmt.setBoolean(16, data.perfect);
|
||||
stmt.setInt(17, data.mods);
|
||||
stmt.setString(19, data.playerName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user