rs = ps.executeQuery();
HashMap<StatsRecord, String> userStatsToId = new HashMap<StatsRecord, String>();
String temp;
while (rs.next()) {
StatsRecord us = new StatsRecord();
userStatsToId.put(us, rs.getString("stats_id"));
try {
us.setDate(sdf.parse(rs.getString("theDate")));
} catch (ParseException e) {
// shouldn't happen, but the parse method requires it
}
us.setSitePage((temp = rs.getString("page")) == null ? ""
: temp);
us.setQuery1((temp = rs.getString("query1")) == null ? ""
: temp);
us.setQuery2((temp = rs.getString("query2")) == null ? ""
: temp);
us.setQuery3((temp = rs.getString("query3")) == null ? ""
: temp);
us.setQuery4((temp = rs.getString("query4")) == null ? ""
: temp);
us.setQuery5((temp = rs.getString("query5")) == null ? ""
: temp);
us.setReferer((temp = rs.getString("referer")) == null ? ""
: temp);
results.add(us);
}
ps.close();
rs.close();
sql = new StringBuffer("select ip_address, "
+ "session_id, spider_from, user_agent, "
+ "returning_user, cookies, "
+ "javascript, plugins, server, "
+ "inst_code, inst_name, referer ");
sql.append("from stats_user_sessions ");
sql.append("where stats_id=? ");
String id;
for (StatsRecord us : userStatsToId.keySet()) {
id = userStatsToId.get(us);
ps = conn.prepareStatement(sql.toString());
ps.setString(1, id);
rs = ps.executeQuery();
rs.next();
us
.setIpAddress((temp = rs.getString("ip_address")) == null ? "0.0.0.0"
: temp);
us
.setJSessionId((temp = rs.getString("session_id")) == null ? ""
: temp);
us
.setFromSpider((temp = rs.getString("spider_from")) == null ? ""
: temp);
us
.setUserAgent((temp = rs.getString("user_agent")) == null ? ""
: temp);
us.setReturningUser(rs.getBoolean("returning_user"));
us.setHasCookies(rs.getBoolean("cookies"));
us.setHasJavaScript(rs.getBoolean("javascript"));
us
.setUserAgent((temp = rs.getString("user_agent")) == null ? ""
: temp);
us.setPlugIns((temp = rs.getString("plugins")) == null ? ""
: temp);
us.setServer((temp = rs.getString("server")) == null ? ""
: temp);
us.setInstCode((temp = rs.getString("inst_code")) == null ? ""
: temp);
us.setInstName((temp = rs.getString("inst_name")) == null ? ""
: temp);
us.setReferer((temp = rs.getString("referer")) == null ? ""
: temp);
ps.close();
rs.close();
}