Minor fix in logs

This commit is contained in:
Yohan Simard 2020-12-20 01:05:11 +01:00
parent d24550fd63
commit e7a77a8670

View file

@ -115,7 +115,6 @@ public class DatabaseController {
Log.v(getClass().getSimpleName(), "Fetching users from db... ");
ResultSet res = stmt.executeQuery(sql);
Log.v(getClass().getSimpleName(), res.getFetchSize() + " rows fetched");
ArrayList<User> userList = new ArrayList<>();
while (res.next()) {
@ -123,6 +122,7 @@ public class DatabaseController {
String username = res.getString("username");
userList.add(new User(id, username));
}
Log.v(getClass().getSimpleName(), userList.size() + " rows fetched");
res.close();
stmt.close();
@ -168,8 +168,8 @@ public class DatabaseController {
// Insert the user if not already existing
final String insertUserSql =
"INSERT OR IGNORE INTO user" +
"(id, username)" +
"INSERT OR IGNORE INTO user " +
"(id, username) " +
"VALUES (?, ?)";
PreparedStatement insertUserStmt = connection.prepareStatement(insertUserSql);
// Add sender
@ -215,12 +215,11 @@ public class DatabaseController {
"FROM message JOIN user AS s ON sender = s.id " +
" JOIN user AS r ON recipient = r.id " +
"WHERE (s.id = " + user.id + " OR r.id = " + user.id + ") AND " +
"timestamp > " + from.getTime() + " AND timestamp < " + to.getTime() +
" ORDER BY timestamp";
"timestamp > " + from.getTime() + " AND timestamp < " + to.getTime() + " " +
"ORDER BY timestamp";
Log.v(getClass().getSimpleName(), "Fetching chat history from db... ");
ResultSet res = stmt.executeQuery(sql);
Log.v(getClass().getSimpleName(), res.getFetchSize() + " rows fetched");
ArrayList<Message> chatHistory = new ArrayList<>();
while (res.next()) {
@ -238,6 +237,7 @@ public class DatabaseController {
// chatHistory.add(new FileMessage(new UserInformation(sId, sUsername), new UserInformation(rId, rUsername), date, text, filePath));
}
}
Log.v(getClass().getSimpleName(), chatHistory.size() + " rows fetched");
res.close();
stmt.close();
if (callback != null) {