*
* @return stats or <code>NULL</code> if row isn't there.
*/
private VisitStats getFeedVisitStats(long id)
{
VisitStats stats = null;
try
{
Statement stmt = pm.getConnection().createStatement();
ResultSet rs = stmt.executeQuery(
"SELECT FS.*, COALESCE(DF.TITLE, DF.XMLURL, QF.TITLE, SF.TITLE) TITLE " +
"FROM FEEDSTATS FS LEFT JOIN DIRECTFEEDS DF ON DF.FEEDID=FS.FEEDID " +
"LEFT JOIN QUERYFEEDS QF ON QF.FEEDID=FS.FEEDID " +
"LEFT JOIN SEARCHFEEDS SF ON SF.FEEDID=FS.FEEDID " +
"WHERE FEEDID = " + id);
if (rs.next())
{
stats = new VisitStats((int)id,
rs.getString("TITLE"),
rs.getLong("COUNT_TOTAL"),
rs.getLong("COUNT_RESET"),
rs.getLong("INIT_TIME"),
rs.getLong("RESET_TIME"));