1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 16:56:16 +00:00

Added a database version check to 51converter.

This commit is contained in:
Fabian Schlenz 2017-02-23 07:00:59 +01:00
parent 803919ca4a
commit dd2f88cf9a

View File

@ -102,7 +102,14 @@ public class Database {
public void jsonify() { public void jsonify() {
try { try {
ResultSet rs = stmt.executeQuery("SELECT id, data FROM messages WHERE api_layer=51"); ResultSet rs = stmt.executeQuery("SELECT max(version) FROM database_versions");
rs.next();
if (rs.getInt(1) != 8) {
System.out.println("This tool will only run on a database version 8. Found: " + rs.getInt(1));
System.exit(1);
}
rs.close();
rs = stmt.executeQuery("SELECT id, data FROM messages WHERE api_layer=51");
PreparedStatement ps = conn.prepareStatement("UPDATE messages SET json=? WHERE id=?"); PreparedStatement ps = conn.prepareStatement("UPDATE messages SET json=? WHERE id=?");
Gson gson = Utils.getGson(); Gson gson = Utils.getGson();
while(rs.next()) { while(rs.next()) {