public override bool BulkLoad(List <EventMetadata> meta, out List <Exception> exceptions) { exceptions = new List <Exception>(); if (meta.Count == 1) { return(base.BulkLoad(meta, out exceptions)); } try { DataTable mt = Build_MetadataTable(); foreach (EventMetadata m in meta) { mt.Rows.Add(new object[] { m.EventID.ToString(), m.Metadata, STEM.Sys.State.KeyManager.GetHash(m.Metadata) }); } ExecuteNonQuery enq = new ExecuteNonQuery(); enq.ImportDataTable(Authentication, mt, mt.TableName, TimeoutRetryAttempts); return(exceptions.Count == 0); } catch { return(base.BulkLoad(meta, out exceptions)); } }
public override bool BulkLoad(List <ObjectData> objects, out List <Exception> exceptions) { exceptions = new List <Exception>(); if (objects.Count == 1) { return(base.BulkLoad(objects, out exceptions)); } try { DataTable ot = Build_ObjectsTable(); foreach (ObjectData o in objects) { ot.Rows.Add(new object[] { o.ID.ToString(), o.Name, o.CreationTime.ToString("G"), STEM.Sys.State.KeyManager.GetHash(o.Name) }); } ExecuteNonQuery enq = new ExecuteNonQuery(); enq.ImportDataTable(Authentication, ot, ot.TableName, TimeoutRetryAttempts); return(exceptions.Count == 0); } catch { return(base.BulkLoad(objects, out exceptions)); } }
public override bool BulkLoad(List <EventData> events, out List <Exception> exceptions) { exceptions = new List <Exception>(); if (events.Count == 1) { return(base.BulkLoad(events, out exceptions)); } try { DataTable et = Build_EventTable(); foreach (EventData e in events) { et.Rows.Add(new object[] { e.EventID.ToString(), e.ObjectID.ToString(), e.EventName, e.MachineName, e.ProcessName, e.EventTime.ToString("G") }); } ExecuteNonQuery enq = new ExecuteNonQuery(); enq.ImportDataTable(Authentication, et, et.TableName, TimeoutRetryAttempts); return(exceptions.Count == 0); } catch { return(base.BulkLoad(events, out exceptions)); } }
public override bool BulkLoad(List <EventData> events, out List <Exception> exceptions) { exceptions = new List <Exception>(); try { Dictionary <string, string> map = new Dictionary <string, string>(); string sql = String.Join("\r\n", LogEventSql); if (sql.Trim() == "") { throw new EmptyLoggerReference("SQL string was empty in " + LoggerName + "."); } string cat = ""; foreach (EventData e in events) { map["[EventID]"] = e.EventID.ToString(); map["[ObjectID]"] = e.ObjectID.ToString(); map["[ObjectName]"] = e.ObjectName; map["[ObjectNameHash]"] = STEM.Sys.State.KeyManager.GetHash(e.ObjectName).ToString(); map["[MachineName]"] = e.MachineName; map["[ProcessName]"] = e.ProcessName; map["[EventName]"] = e.EventName; map["[EventTime]"] = e.EventTime.ToString("G"); cat += "\r\n" + STEM.Surge.KVPMapUtils.ApplyKVP(sql, map, false); } ExecuteNonQuery enq = new ExecuteNonQuery(); cat = STEM.Surge.KVPMapUtils.ApplyKVP(cat, map, false); enq.Execute(Authentication, cat, TimeoutRetryAttempts); } catch (Exception ex) { exceptions.Add(ex); } return(exceptions.Count == 0); }