aboutsummaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2012-10-14 11:45:34 +0700
committerGravatar Ugnich Anton2012-10-14 11:45:34 +0700
commit6df2be1e680adb8f9c8a186fae05dd7357280c95 (patch)
tree0c0f99a8b4f8c0be72a5c4a4e77829035f71ed13 /src/com
parent84de24ebd67552e8f1ee01a377a0437b00a8db0e (diff)
getMessageRecommendations
Diffstat (limited to 'src/com')
-rw-r--r--src/com/juick/server/MessagesQueries.java25
1 files changed, 25 insertions, 0 deletions
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 += "<a href=\"/" + rs.getString(1) + "/\">@" + rs.getString(1) + "</a>";
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ return ret;
+ }
+
public static ArrayList<Integer> getAll(Connection sql, int before) {
ArrayList<Integer> mids = new ArrayList<Integer>(20);