diff --git a/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java b/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java index 6f88259..732eb66 100644 --- a/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java +++ b/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java @@ -223,6 +223,8 @@ public class CommandLineController { String format = "%40s: %d%n"; System.out.format(format, "Number of accounts", Utils.getAccounts().size()); System.out.format(format, "Number of messages", Database.getInstance().getMessageCount()); + System.out.format(format, "Number of chats", Database.getInstance().getChatCount()); + System.out.format(format, "Number of users", Database.getInstance().getUserCount()); System.out.format(format, "Top message ID", Database.getInstance().getTopMessageID()); System.out.println(); diff --git a/src/main/java/de/fabianonline/telegram_backup/Database.java b/src/main/java/de/fabianonline/telegram_backup/Database.java index 0855feb..b715e97 100644 --- a/src/main/java/de/fabianonline/telegram_backup/Database.java +++ b/src/main/java/de/fabianonline/telegram_backup/Database.java @@ -133,9 +133,9 @@ public class Database { } catch (SQLException e) {} } - public int getMessageCount() { + public int queryInt(String query) { try { - ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM messages"); + ResultSet rs = stmt.executeQuery(query); rs.next(); return rs.getInt(1); } catch (SQLException e) { @@ -143,6 +143,10 @@ public class Database { } } + public int getMessageCount() { return queryInt("SELECT COUNT(*) FROM messages"); } + public int getChatCount() { return queryInt("SELECT COUNT(*) FROM chats"); } + public int getUserCount() { return queryInt("SELECT COUNT(*) FROM users"); } + public LinkedList getMissingIDs() { try { LinkedList missing = new LinkedList();