/// <summary> /// Fetch at most 'limit' EAnp events from the database, starting at /// evtID. /// </summary> public List<AnpMsg> FetchEAnpEvents(UInt64 kwsID, UInt64 evtID, UInt32 limit) { String s = "SELECT evt_data FROM eanp_events WHERE kws_id = " + kwsID + " AND evt_id > " + evtID + " ORDER BY evt_id LIMIT " + limit + ";"; List<AnpMsg> res = new List<AnpMsg>(); DbDataReader reader = m_db.GetCmd(s).ExecuteReader(); while (reader.Read()) { AnpMsg m = new AnpMsg(); m.FromByteArray((byte[])reader.GetValue(0), true); res.Add(m); } return res; }
/// <summary> /// Helper method for queries fetching an event. /// </summary> private AnpMsg GetEventFromQuery(String s) { Object res = m_db.GetCmd(s).ExecuteScalar(); if (res == null) return null; AnpMsg m = new AnpMsg(); m.FromByteArray((byte[])res, true); return m; }