/// <summary> /// Initializes a new instance of the UnQLite class without UnQLiteException. /// </summary> /// <exception cref="System.ArgumentNullException"> /// fileName is null. /// </exception> public static UnQLiteResultCode TryOpen(string fileName, UnQLiteOpenModel model, out UnQLite unqlite) { if (fileName == null) { throw new ArgumentNullException("fileName"); } unqlite = null; IntPtr pDB; UnQLiteResultCode code = UnsafeNativeMethods.unqlite_open(out pDB, fileName, model); if (code == UnQLiteResultCode.Ok) { unqlite = new UnQLite(pDB); } return(code); }
/// <summary> /// Constructor /// </summary> /// <param name="path"></param> /// <param name="mode"></param> public UnQEntitybase(string path, UnQMode mode) { if (mode == UnQMode.Open) { if (!System.IO.File.Exists(path)) { throw new Exception($"tsdb config '{path}' not exists"); } unqlite = new UnQLite(path, UnQLiteOpenModel.ReadWrite); } if (mode == UnQMode.Override) { if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } unqlite = new UnQLite(path, UnQLiteOpenModel.Create); } else { unqlite = new UnQLite(path, UnQLiteOpenModel.Create); } this.Entities = new Dictionary <string, UnQRecord>(); }
internal UnQLiteTransaction(UnQLite unqlite) { unQLite_ = unqlite; unQLite_.isAutoCommit_ = false; }
/// <summary> /// create a database in memory /// </summary> public UnQEntitybase() { unqlite = new UnQLite(inmemory, UnQLiteOpenModel.Create); this.Entities = new Dictionary <string, UnQRecord>(); }