public void Open(mpIndexKey getKey, string xName) { if (LoTable != null) { Close(); } TableFile.Open(Name, this, getKey, xName); }
public void Open() { if (LoTable != null) { Close(); } TableFile.Open(Name, this, null, null); }
public void Create() { if (LoTable != null) { throw new System.InvalidOperationException("MinBase: Attempt to overwrite a table which is open."); } TableFile.Create(Name, this); }
internal static void Create(string nm, Table obj) { TableFile db; if (OpenList.TryGetValue(nm, out db)) { throw new System.InvalidOperationException("MinBase: Cannot create table " + nm + " because there is a perviously open table with the same name."); } db = new TableFile(); Struct stt = new Struct(); db.File = DataFile.Open(nm, "Table", FileMode.CreateNew); stt.RowLength = DataFile.GetSize(obj); stt.RowCount = 0; db.File.Append(stt, DataFile.GetSize(stt)); db.File.Close(); }
internal static void Open(string nm, Table obj, mpIndexKey gkey, string xn) { TableFile db; SyncOpen.WaitOne(); if (OpenList.TryGetValue(nm, out db)) { db.OpenCount++; } else { db = new TableFile(); db.Alias = nm; db.File = DataFile.Open(nm, "Table", FileMode.Open); db.Struct = new Struct(); int sz = DataFile.GetSize(db.Struct); db.File.Read(db.Struct, DataFile.coSignatureSz, sz); db.File.Lock(db.Struct); db.OpenCount = 1; db.Data = DataFile.coSignatureSz + sz; long cz = db.Data + db.Struct.RowLength * db.Struct.RowCount; long fz = db.File.LoFile.Length; if (cz != fz) { db.Struct.LastUpdate = DateTime.Now; db.File.Write(db.Struct); db.File.CopyTo(String.Format("{0}{1:yyyy}{1:MM}{1:dd}{1:HH}{1:mm}{1:ss}", nm, db.Struct.LastUpdate), "BackupTable"); db.File.LoFile.SetLength(cz); } OpenList.Add(nm, db); } SyncOpen.ReleaseMutex(); obj.LoTable = db; if (gkey == null) { obj.Order = null; } else { obj.Order = db.SetView(obj, xn, gkey); } obj.First(); }
public void Destroy() { TableFile.Destroy(Name); }
public bool Exists() { return(TableFile.Exists(Name)); }