mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Chatlog ordered by timestamp
This commit is contained in:
parent
c83f7cd364
commit
2e40f295df
@ -207,7 +207,7 @@ public class ModToolManager {
|
|||||||
public ArrayList<ModToolChatLog> getUserChatlog(int userId) {
|
public ArrayList<ModToolChatLog> getUserChatlog(int userId) {
|
||||||
ArrayList<ModToolChatLog> chatlogs = new ArrayList<>();
|
ArrayList<ModToolChatLog> chatlogs = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY timestamp DESC LIMIT 150")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, users.id, chatlogs_room.* FROM chatlogs_room INNER JOIN users ON users.id = chatlogs_room.user_from_id WHERE user_from_id = ? ORDER BY chatlogs_room.timestamp DESC LIMIT 150")) {
|
||||||
statement.setInt(1, userId);
|
statement.setInt(1, userId);
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
@ -224,7 +224,7 @@ public class ModToolManager {
|
|||||||
public ArrayList<ModToolChatLog> getMessengerChatlog(int userOneId, int userTwoId) {
|
public ArrayList<ModToolChatLog> getMessengerChatlog(int userOneId, int userTwoId) {
|
||||||
ArrayList<ModToolChatLog> chatLogs = new ArrayList<>();
|
ArrayList<ModToolChatLog> chatLogs = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY timestamp DESC LIMIT 50")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.username, chatlogs_private.* FROM chatlogs_private INNER JOIN users ON users.id = user_from_id WHERE (user_from_id = ? AND user_to_id = ?) OR (user_from_id = ? AND user_to_id = ?) ORDER BY chatlogs_private.timestamp DESC LIMIT 50")) {
|
||||||
statement.setInt(1, userOneId);
|
statement.setInt(1, userOneId);
|
||||||
statement.setInt(2, userTwoId);
|
statement.setInt(2, userTwoId);
|
||||||
statement.setInt(3, userTwoId);
|
statement.setInt(3, userTwoId);
|
||||||
|
Loading…
Reference in New Issue
Block a user