private void _InitializeDatabase() { m_database = new DatabaseLink(System.AppDomain.CurrentDomain.BaseDirectory + @"tags.db", "TagDB"); //ensure that the tags and filetags tables exist in the database m_database.ExecuteNonQuery(@"CREATE TABLE IF NOT EXISTS [Tags] ([id] INTEGER NOT NULL PRIMARY KEY UNIQUE, [label] TEXT NOT NULL UNIQUE, [color] TEXT NOT NULL UNIQUE, [children] TEXT NOT NULL DEFAULT '');"); m_database.ExecuteNonQuery(@"CREATE INDEX IF NOT EXISTS [Label_Index] on [Tags](label);"); m_database.ExecuteNonQuery(@"CREATE TABLE IF NOT EXISTS [FileTags] ([path] TEXT NOT NULL PRIMARY KEY UNIQUE, [tags] TEXT NOT NULL UNIQUE);"); }
private void _InitializeDatabase() { try { m_database = new DatabaseLink(System.AppDomain.CurrentDomain.BaseDirectory + @"\cache.db", "CacheDB"); //ensure that the database has the necessary tables and indexes m_database.ExecuteNonQuery(@"CREATE TABLE IF NOT EXISTS [FileCache] ([id] INTEGER NOT NULL PRIMARY KEY UNIQUE, [path] TEXT NOT NULL UNIQUE, [name] TEXT NOT NULL, [type] INTEGER NOT NULL, [tags] TEXT NOT NULL DEFAULT '', [access_count] INTEGER NOT NULL DEFAULT 0, [favorite] INTEGER NOT NULL DEFAULT 0, [hidden] INTEGER NOT NULL DEFAULT 0);"); m_database.ExecuteNonQuery(@"CREATE INDEX IF NOT EXISTS [name_index] ON [FileCache] (name);"); } catch (Exception crap) { Settings.SessionLog += crap.Message + "\n"; Debug.WriteLine(crap.Message); } m_databaseSearcher = new DatabaseSearcher(m_database); m_databaseSearcher.SearchComplete += _DatabaseSearcher_SearchComplete; m_databaseSearcher.SearchStarting += _DatabaseSearcher_SearchStarting; m_databaseSearcher.SearchCancelled += _DatabaseSearcher_SearchCancelled; }