private void InitDataBase() { //GlobalConnection.Init(); if (!File.Exists(AIDataBasePath)) { MySqlite db = new MySqlite(AIDataBasePath); db.CreateTable(DataBase.SQLITETABLE_BAIDUAI); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite(AIDataBasePath); if (!db.IsTableExist("baidu")) { db.CreateTable(DataBase.SQLITETABLE_BAIDUAI); } db.CloseDB(); } if (!File.Exists(TranslateDataBasePath)) { MySqlite db = new MySqlite(TranslateDataBasePath); db.CreateTable(DataBase.SQLITETABLE_YOUDAO); db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite(TranslateDataBasePath); if (!db.IsTableExist("youdao")) { db.CreateTable(DataBase.SQLITETABLE_YOUDAO); } if (!db.IsTableExist("baidu")) { db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE); } db.CloseDB(); } if (!File.Exists(MagnetsDataBasePath)) { MySqlite db = new MySqlite(MagnetsDataBasePath); db.CreateTable(DataBase.SQLITETABLE_MAGNETS); db.CloseDB(); } }
private void InitDataBase() { if (!File.Exists(AIDataBasePath)) { MySqlite db = new MySqlite("AI"); db.CreateTable(DataBase.SQLITETABLE_BAIDUAI); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite("AI"); if (!db.IsTableExist("baidu")) { db.CreateTable(DataBase.SQLITETABLE_BAIDUAI); } db.CloseDB(); } if (!File.Exists(TranslateDataBasePath)) { MySqlite db = new MySqlite("Translate"); db.CreateTable(DataBase.SQLITETABLE_YOUDAO); db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite("Translate"); if (!db.IsTableExist("youdao")) { db.CreateTable(DataBase.SQLITETABLE_YOUDAO); } if (!db.IsTableExist("baidu")) { db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE); } db.CloseDB(); } }
private void Init() { Sqlite = new MySqlite(SqliteConfigPath); foreach (string key in tables.Keys) { if (!Sqlite.IsTableExist(key)) { Sqlite.CreateTable(tables[key]); } } }
public bool UpdateSqliteInfoPath(SqliteInfo sqliteInfo) { if (Sqlite.IsTableExist("databases")) { SQLiteCommand cmd = Sqlite.cmd; cmd.CommandText = $"UPDATE databases SET Path=@Path,Name=@Name where ID=@ID"; cmd.Parameters.Add("ID", DbType.Int64).Value = sqliteInfo.ID; cmd.Parameters.Add("Path", DbType.String).Value = sqliteInfo.Path; cmd.Parameters.Add("Name", DbType.String).Value = sqliteInfo.Name; int result = cmd.ExecuteNonQuery(); return(result > 0); } return(false); }
private void InitDataBase() { if (!File.Exists(InfoDataBasePath)) { MySqlite db = new MySqlite("Info"); db.CreateTable(DataBase.SQLITETABLE_MOVIE); db.CreateTable(DataBase.SQLITETABLE_ACTRESS); db.CreateTable(DataBase.SQLITETABLE_LIBRARY); db.CreateTable(DataBase.SQLITETABLE_JAVDB); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite("Info"); if (!db.IsTableExist("movie") || !db.IsTableExist("actress") || !db.IsTableExist("library") || !db.IsTableExist("javdb")) { db.CreateTable(DataBase.SQLITETABLE_MOVIE); db.CreateTable(DataBase.SQLITETABLE_ACTRESS); db.CreateTable(DataBase.SQLITETABLE_LIBRARY); db.CreateTable(DataBase.SQLITETABLE_JAVDB); } db.CloseDB(); } if (!File.Exists(AIDataBasePath)) { MySqlite db = new MySqlite("AI"); db.CreateTable(DataBase.SQLITETABLE_BAIDUAI); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite("AI"); if (!db.IsTableExist("baidu")) { db.CreateTable(DataBase.SQLITETABLE_BAIDUAI); } db.CloseDB(); } if (!File.Exists(TranslateDataBasePath)) { MySqlite db = new MySqlite("Translate"); db.CreateTable(DataBase.SQLITETABLE_YOUDAO); db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE); db.CloseDB(); } else { //是否具有表结构 MySqlite db = new MySqlite("Translate"); if (!db.IsTableExist("youdao")) { db.CreateTable(DataBase.SQLITETABLE_YOUDAO); } if (!db.IsTableExist("baidu")) { db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE); } db.CloseDB(); } }