From 6df2be1e680adb8f9c8a186fae05dd7357280c95 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Sun, 14 Oct 2012 11:45:34 +0700
Subject: getMessageRecommendations
---
src/com/juick/server/MessagesQueries.java | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java
index b406eb39..3ec412b0 100644
--- a/src/com/juick/server/MessagesQueries.java
+++ b/src/com/juick/server/MessagesQueries.java
@@ -160,6 +160,31 @@ public class MessagesQueries {
return user;
}
+ public static String getMessageRecommendations(Connection sql, int mid) {
+ String ret = "";
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT users.nick FROM favorites INNER JOIN users ON (favorites.message_id=? AND favorites.user_id=users.id)");
+ stmt.setInt(1, mid);
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ while (rs.next()) {
+ if (!ret.isEmpty()) {
+ ret += ", ";
+ }
+ ret += "@" + rs.getString(1) + "";
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ return ret;
+ }
+
public static ArrayList getAll(Connection sql, int before) {
ArrayList mids = new ArrayList(20);
--
cgit v1.2.3