log.debug("Executing SQL query: {}", getAllUsersSQL);
rs = stmt.executeQuery(getAllUsersSQL);
boolean currentUserIDSet = false;
long currentUserID = 0L; // value isn't used
FastIDSet currentItemIDs = new FastIDSet(2);
while (rs.next()) {
long nextUserID = getLongColumn(rs, 1);
if (currentUserIDSet && (currentUserID != nextUserID)) {
if (!currentItemIDs.isEmpty()) {
result.put(currentUserID, currentItemIDs);
currentItemIDs = new FastIDSet(2);
}
} else {
currentItemIDs.add(getLongColumn(rs, 2));
}
currentUserID = nextUserID;
currentUserIDSet = true;
}
if (!currentItemIDs.isEmpty()) {
result.put(currentUserID, currentItemIDs);
}
return result;