Close our JDBC statement when we're done with it.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@123 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: UserRepository.java,v 1.8 2001/05/26 04:37:35 mdb Exp $
|
// $Id: UserRepository.java,v 1.9 2001/05/26 07:09:38 mdb Exp $
|
||||||
|
|
||||||
package com.samskivert.servlet.user;
|
package com.samskivert.servlet.user;
|
||||||
|
|
||||||
@@ -299,15 +299,21 @@ public class UserRepository extends MySQLRepository
|
|||||||
// do the query
|
// do the query
|
||||||
IntMap map = new IntMap();
|
IntMap map = new IntMap();
|
||||||
Statement stmt = _session.connection.createStatement();
|
Statement stmt = _session.connection.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery("select userid, " + column +
|
try {
|
||||||
|
String query = "select userid, " + column +
|
||||||
" from users " +
|
" from users " +
|
||||||
"where userid in (" + ids + ")");
|
"where userid in (" + ids + ")";
|
||||||
|
ResultSet rs = stmt.executeQuery(query);
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int userid = rs.getInt(1);
|
int userid = rs.getInt(1);
|
||||||
String name = rs.getString(2);
|
String name = rs.getString(2);
|
||||||
map.put(userid, name);
|
map.put(userid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
stmt.close();
|
||||||
|
}
|
||||||
|
|
||||||
// finally construct our result
|
// finally construct our result
|
||||||
String[] result = new String[userids.length];
|
String[] result = new String[userids.length];
|
||||||
for (int i = 0; i < userids.length; i++) {
|
for (int i = 0; i < userids.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user