diff options
author | Ugnich Anton | 2014-02-09 04:54:56 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-02-09 04:54:56 +0700 |
commit | 18c9e608fa38b136e581adb974b29e4c5a446dc9 (patch) | |
tree | 94da37705811d30ea343177694b2c3be06169cfe /src/com/juick/server/MessagesQueries.java | |
parent | 636b44d06dfbf84210c44f488659e629ed4db0ec (diff) |
Votes
Diffstat (limited to 'src/com/juick/server/MessagesQueries.java')
-rw-r--r-- | src/com/juick/server/MessagesQueries.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index bf26b70b..dcba6830 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -130,7 +130,7 @@ public class MessagesQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT messages.user_id,users.nick,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.readonly,messages.privacy,messages.replies,messages.attach,messages.place_id,messages.lat,messages.lon FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id=?"); + stmt = sql.prepareStatement("SELECT messages.user_id,users.nick,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.readonly,messages.privacy,messages.replies,messages.attach,messages.place_id,messages.lat,messages.lon,messages.votes FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id=?"); stmt.setInt(1, mid); rs = stmt.executeQuery(); if (rs.first()) { @@ -154,6 +154,7 @@ public class MessagesQueries { msg.Place.lat = rs.getDouble(10); msg.Place.lon = rs.getDouble(11); } + msg.Votes = rs.getInt(12); } } catch (SQLException e) { System.err.println(e); @@ -810,7 +811,7 @@ public class MessagesQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.replies,messages_txt.repliesby,messages.attach,messages.lat,messages.lon FROM (messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id IN (" + Utils.convertArrayInt2String(mids) + ") ORDER BY messages.message_id DESC"); + stmt = sql.prepareStatement("SELECT STRAIGHT_JOIN messages.message_id,messages.user_id,users.nick,messages_txt.tags,messages.readonly,messages.privacy,messages_txt.txt,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),DATE_FORMAT(messages.ts,'%Y-%m-%d %H:%i:%s'),messages.replies,messages_txt.repliesby,messages.attach,messages.lat,messages.lon,messages.votes FROM (messages INNER JOIN messages_txt ON messages.message_id=messages_txt.message_id) INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id IN (" + Utils.convertArrayInt2String(mids) + ") ORDER BY messages.message_id DESC"); rs = stmt.executeQuery(); rs.beforeFirst(); while (rs.next()) { @@ -837,6 +838,7 @@ public class MessagesQueries { msg.Place.lat = rs.getDouble(13); msg.Place.lon = rs.getDouble(14); } + msg.Votes = rs.getInt(15); msgs.add(msg); } |