public RunningAverage[] GetDiffs(Object userID, Object itemID, IList <Preference> prefs) { int size = prefs.Count; RunningAverage[] result = new RunningAverage[size]; try { using (IDbCommand cmd = dataModel.CreateCommand(getDiffsSQL)) { ConfigureGetDiffsCommand(cmd, itemID, userID); if (log.IsDebugEnabled) { log.DebugFormat("Executing SQL query: {0}", getDiffsSQL); } int i = 0; using (IDataReader rs = cmd.ExecuteReader()) { while (rs.Read()) { result[i++] = new FixedRunningAverage(rs.GetInt32(1), rs.GetDouble(2)); } } if (i != size) { throw new TasteException("Wrong number of prefs read from database"); } } } catch (Exception sqle) { log.Warn("Exception while retrieving diff", sqle); throw new TasteException(sqle); } return(result); }
public RunningAverage[] GetDiffs(Object userID, Object itemID, IList<Preference> prefs) { int size = prefs.Count; RunningAverage[] result = new RunningAverage[size]; try { using (IDbCommand cmd = dataModel.CreateCommand(getDiffsSQL)) { ConfigureGetDiffsCommand(cmd, itemID, userID); if (log.IsDebugEnabled) { log.DebugFormat("Executing SQL query: {0}", getDiffsSQL); } int i = 0; using (IDataReader rs = cmd.ExecuteReader()) { while (rs.Read()) { result[i++] = new FixedRunningAverage(rs.GetInt32(1), rs.GetDouble(2)); } } if (i != size) { throw new TasteException("Wrong number of prefs read from database"); } } } catch (Exception sqle) { log.Warn("Exception while retrieving diff", sqle); throw new TasteException(sqle); } return result; }