public void Init(string path, bool create_if_missing) { bool new_db = !File.Exists(path); this.path = path; if (new_db && !create_if_missing) { throw new Exception(path + ": File not found"); } database = new QueuedSqliteDatabase(path); // Load or create the meta table meta_store = new MetaStore(Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run(this); Database.BeginTransaction(); face_store = new FaceStore(Database, new_db); tag_store = new TagStore(Database, new_db); roll_store = new RollStore(Database, new_db); export_store = new ExportStore(Database, new_db); job_store = new JobStore(Database, new_db); photo_store = new PhotoStore(Database, new_db); Database.CommitTransaction(); empty = new_db; }
public void Init(string path, bool create_if_missing) { uint timer = Log.DebugTimerStart(); bool new_db = !File.Exists(path); this.path = path; if (new_db && !create_if_missing) { throw new Exception(path + ": File not found"); } database = new QueuedSqliteDatabase(path); database.ExceptionThrown += HandleDbException; if (database.GetFileVersion(path) == 2) { SqliteUpgrade(); } // Load or create the meta table meta_store = new MetaStore(Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run(this); Database.BeginTransaction(); tag_store = new TagStore(Database, new_db); roll_store = new RollStore(Database, new_db); export_store = new ExportStore(Database, new_db); job_store = new JobStore(Database, new_db); photo_store = new PhotoStore(Database, new_db); Database.CommitTransaction(); empty = new_db; Log.DebugTimerPrint(timer, "Db Initialization took {0}"); }