private ArchivedData(ArchiveControl archive, long id) { mArchiveControl = archive; mID = id; this.Read(); }
public SqlArchiveMethod(ArchiveControl ctl) : base(ctl) { string[] split = ctl.ArchiveInfo.Split(new Char[] { ';' }); dbServer = split[0]; dbDatabase = split[1]; dbTable = split[2]; mArchiveControl = ctl; insertSql = "Insert into " + dbTable + " (RecID,ControlID,data) Values(@ID,@controlID,@data)"; deleteSql = "Delete " + dbTable + " where RecID = @ID AND controlID = @controlID"; selectSql = "Select data from " + dbTable + " where RecID = @ID AND controlID = @controlID"; squtil = new SqlUtil(dbServer, dbDatabase, "sql database archiver"); }
public ArchiveControl(ArchiveConfig cfg, ArchiveControl.ArchiveTypeEnum type) : this() { ArchiveControl ctl = this; ctl.ArchiveType = type; ctl.TablePath = cfg.FullTablePath; ctl.mArchiveConfg = cfg; if (type == ArchiveControl.ArchiveTypeEnum.Record) { ctl.ArchiveMethodType = cfg.RecordArchiveMethodType; ctl.ArchiveInfo = cfg.RecordArchiveInfo; ctl.IsCompressed = cfg.IsRecordCompressed; ctl.IsSqueezed = cfg.IsRecordSqueezed; } else { ctl.ArchiveMethodType = cfg.ColumnArchiveMethodType; ctl.ArchiveInfo = cfg.ColumnArchiveInfo; ctl.IsCompressed = cfg.IsColumnCompressed; ctl.IsSqueezed = cfg.IsColumnSqueezed; } }
internal void Add(ArchiveControl a) { mTablePath = a.TablePath; mArchiveList.Add(a); //see if this record expands the borders of the archive if (a.ArchiveType == ArchiveControl.ArchiveTypeEnum.Column) { if ((DateTime)a.Range.GetValue(0) < mDateRange[0]) mDateRange[0] = (DateTime)a.Range[0]; if ((DateTime)a.Range.GetValue(1) > mDateRange[1]) mDateRange[1] = (DateTime)a.Range[1]; } else { if ((long)a.Range.GetValue(0) < mIdRange[0]) mIdRange[0] = (long)a.Range[0]; if ((long)a.Range.GetValue(1) > mIdRange[1]) mIdRange[1] = (long)a.Range[1]; } }
private static void CacheCB(DataTable dt) { mArchive.Clear(); ArchiveControlList archiveList; string k; foreach (DataRow r in dt.Rows) { ArchiveControl a = new ArchiveControl(r); k = a.TablePath.ToLower(); archiveList = (ArchiveControlList)mArchive[k]; if (archiveList == null) { archiveList = new ArchiveControlList(); mArchive[k] = archiveList; } archiveList.Add(a); } }
public static ArchiveControl GetMostRecent(string TablePath, ArchiveControl.ArchiveTypeEnum type) { ArchiveControlList acl = GetControlList(TablePath); ArchiveControl found = null; foreach (ArchiveControl ac in acl.mArchiveList) { if (ac.ArchiveType != type) continue; if (found == null) found = ac; else { if (type == ArchiveTypeEnum.Column) { if ((DateTime)ac.Range[1] > (DateTime)found.Range[1]) found = ac; } else { if ((long)ac.Range[1] > (long)found.Range[1]) found = ac; } } } return found; }
//used only by archiver public static ArchiveControl Get(string TablePath, string ArchiveInfo, ArchiveControl.ArchiveTypeEnum ArchiveType) { ArchiveControlList l = GetControlList(TablePath); if (l == null) return null; ArchiveControl found = null; foreach (ArchiveControl a in l.mArchiveList) { if (a.ArchiveType != ArchiveType) continue; if (a.ArchiveInfo == ArchiveInfo) { //once a particular archiveinfo is used, it can not be reused latter on since we will mess up the ranges if (found == null) { found = a; continue; } else throw new Exception(String.Format("trying to reuse archiveinfo for {0}, info {1}", TablePath, ArchiveInfo)); } } return found; }
public FileSystemArchiveMethod(ArchiveControl ctl) : base(ctl) { }