private void DeleteEventFromTable(ReportEvent evt, ConnectionManager cm) { TuDbConnection dbConnection; try { dbConnection = cm.GetConnection(); } catch (DbNoConnections dbn) { throw dbn; } catch (MySql.Data.MySqlClient.MySqlException mex) { throw mex; } catch (Exception ex) { throw ex; } ReportEventsDataAdapter reportEventsDataAdapter = new ReportEventsDataAdapter(dbConnection); try { reportEventsDataAdapter.DeleteEvent(evt); cm.Release(dbConnection); } catch (Exception ex) { cm.Release(dbConnection); throw ex; } }
public void LoadEvents(string threadId, ulong eventId, ConnectionManager connectionManager) { // Get access to the "Queue List" mutex bool isOwned = _queueListMutex.WaitOne(15000); if (!isOwned) { Logger.Debug("Unable to get queue list mutex for event id " + eventId); return; } // Get connection to database from pool TuDbConnection dbConnection; try { dbConnection = connectionManager.GetConnection(); } catch (DbNoConnections dbn) { // Since throwing an exception, ignore any exceptions along the way ReleaseQueueListMutex(false); throw dbn; } catch (MySql.Data.MySqlClient.MySqlException mex) { // Since throwing an exception, ignore any exceptions along the way ReleaseQueueListMutex(false); throw mex; } catch (Exception ex) { // Since throwing an exception, ignore any exceptions along the way ReleaseQueueListMutex(false); throw ex; } // Create the "Report Events" data adapter ReportEventsDataAdapter reportEventsDataAdapter = new ReportEventsDataAdapter(dbConnection); try { // Query the "report_events" table for events with id = "eventId" UInt32 maxEventsToQueue = Convert.ToUInt32(ReportingServiceDatabase.Configuration.ConfigurationReader.GetAppSetting("maxeventstoqueue")); List <ReportEvent> events = reportEventsDataAdapter.GetByEventId(eventId, maxEventsToQueue); ReleaseDbConnection(connectionManager, dbConnection); foreach (ReportEvent e in events) { this._eventQueues[eventId].AddEvent(e); } ReleaseQueueListMutex(); } catch (Exception ex) { // Since throwing an exception, ignore any exceptions along the way ReleaseDbConnection(connectionManager, dbConnection, false); ReleaseQueueListMutex(false); throw ex; } finally { } }