aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2013-06-20 18:30:54 +0700
committerGravatar Ugnich Anton2013-06-20 18:30:54 +0700
commit781648961858a5180098954fc32463c32c88eaa6 (patch)
tree0945918c64ab86a24fce1b95c7242eb9bf3322b1 /src/com/juick
parent505feda055a1f5c59aea53f26680bbbbb0553a0a (diff)
User.getUsersByID
Diffstat (limited to 'src/com/juick')
-rw-r--r--src/com/juick/server/UserQueries.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/juick/server/UserQueries.java b/src/com/juick/server/UserQueries.java
index e44017fa..d6f6045c 100644
--- a/src/com/juick/server/UserQueries.java
+++ b/src/com/juick/server/UserQueries.java
@@ -90,6 +90,30 @@ public class UserQueries {
return user;
}
+ public static ArrayList<com.juick.User> getUsersByID(Connection sql, ArrayList<Integer> uids) {
+ ArrayList<com.juick.User> users = new ArrayList<com.juick.User>();
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT id,nick FROM users WHERE id IN (" + Utils.convertArray2String(uids) + ")");
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ while (rs.next()) {
+ com.juick.User u = new com.juick.User();
+ u.UID = rs.getInt(1);
+ u.UName = rs.getString(2);
+ users.add(u);
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ return users;
+ }
+
public static String getJIDbyUID(Connection sql, int UID) {
String jid = null;