mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-22 16:56:16 +00:00
'--stats' now also counts chats and users in the DB.
This commit is contained in:
parent
be56f21a0f
commit
14d80a70fe
@ -223,6 +223,8 @@ public class CommandLineController {
|
|||||||
String format = "%40s: %d%n";
|
String format = "%40s: %d%n";
|
||||||
System.out.format(format, "Number of accounts", Utils.getAccounts().size());
|
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 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.format(format, "Top message ID", Database.getInstance().getTopMessageID());
|
||||||
|
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
@ -133,9 +133,9 @@ public class Database {
|
|||||||
} catch (SQLException e) {}
|
} catch (SQLException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMessageCount() {
|
public int queryInt(String query) {
|
||||||
try {
|
try {
|
||||||
ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM messages");
|
ResultSet rs = stmt.executeQuery(query);
|
||||||
rs.next();
|
rs.next();
|
||||||
return rs.getInt(1);
|
return rs.getInt(1);
|
||||||
} catch (SQLException e) {
|
} 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<Integer> getMissingIDs() {
|
public LinkedList<Integer> getMissingIDs() {
|
||||||
try {
|
try {
|
||||||
LinkedList<Integer> missing = new LinkedList<Integer>();
|
LinkedList<Integer> missing = new LinkedList<Integer>();
|
||||||
|
Loading…
Reference in New Issue
Block a user