aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/MessagesQueries.java
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-11-19 02:46:34 +0700
committerGravatar Ugnich Anton2013-11-19 02:46:34 +0700
commit236876e168fd865230fb94c53be4cac4ada6e46b (patch)
treef1c51ed49629b06f98dc3c77660191bfe6723a0c /src/com/juick/server/MessagesQueries.java
parentc0ccfe940d00f4eeb888c5f721e8a63c415daeb3 (diff)
MessagesQueries: -places, *search sql
Diffstat (limited to 'src/com/juick/server/MessagesQueries.java')
-rw-r--r--src/com/juick/server/MessagesQueries.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java
index 8a3b1268..1aeb45f8 100644
--- a/src/com/juick/server/MessagesQueries.java
+++ b/src/com/juick/server/MessagesQueries.java
@@ -735,12 +735,12 @@ public class MessagesQueries {
ResultSet rs = null;
try {
if (before > 0) {
- stmt = sqlSearch.prepareStatement("SELECT @id AS message_id FROM messages WHERE user_id=? AND MATCH(?) AND @id<? ORDER BY id DESC LIMIT 20");
+ stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE user_id=? AND MATCH(?) AND id<? ORDER BY id DESC LIMIT 20");
stmt.setInt(1, UID);
stmt.setString(2, search);
stmt.setInt(3, before);
} else {
- stmt = sqlSearch.prepareStatement("SELECT @id AS message_id FROM messages WHERE user_id=? AND MATCH(?) ORDER BY id DESC LIMIT 20");
+ stmt = sqlSearch.prepareStatement("SELECT id AS message_id FROM messages WHERE user_id=? AND MATCH(?) ORDER BY id DESC LIMIT 20");
stmt.setInt(1, UID);
stmt.setString(2, search);
}
@@ -780,7 +780,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()),messages.ts,messages.replies,messages_txt.repliesby,messages.attach,messages.place_id,places.name,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) LEFT JOIN places ON messages.place_id=places.place_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()),messages.ts,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");
rs = stmt.executeQuery();
rs.beforeFirst();
while (rs.next()) {
@@ -801,12 +801,10 @@ public class MessagesQueries {
msg.Replies = rs.getInt(10);
msg.RepliesBy = rs.getString(11);
msg.AttachmentType = rs.getString(12);
- if (rs.getInt(13) > 0) {
+ if (rs.getDouble(13) != 0) {
msg.Place = new com.juick.Place();
- msg.Place.pid = rs.getInt(13);
- msg.Place.name = rs.getString(14);
- msg.Place.lat = rs.getDouble(15);
- msg.Place.lon = rs.getDouble(16);
+ msg.Place.lat = rs.getDouble(13);
+ msg.Place.lon = rs.getDouble(14);
}
msgs.add(msg);