Skip to content
Snippets Groups Projects
Commit 7716fa7e authored by noberumotto's avatar noberumotto
Browse files

修复升级到1.0.0.3版本数据迁移某些情况下崩溃的问题

parent 96b9075e
Branches
No related merge requests found
...@@ -178,9 +178,10 @@ namespace Core.Librarys.SQLite ...@@ -178,9 +178,10 @@ namespace Core.Librarys.SQLite
} }
if (!isNew)
HandleVersion1002Migrate(); {
HandleVersion1002Migrate();
}
// 处理表字段删除 // 处理表字段删除
foreach (var dbModel in modelInfosDb) foreach (var dbModel in modelInfosDb)
...@@ -278,9 +279,10 @@ namespace Core.Librarys.SQLite ...@@ -278,9 +279,10 @@ namespace Core.Librarys.SQLite
var ID = rd[0]; var ID = rd[0];
var Name = rd[1].ToString(); var Name = rd[1].ToString();
var Description = rd[2].ToString(); var Description = rd[2].ToString();
var icon = Iconer.Get(Name, Description); var icon = Iconer.Get(Name, Description);
Name = SQLiteEscape(Name);
sqlList.Add($"update DailyLogModels set AppModelID={ID} where ProcessName='{Name}'"); sqlList.Add($"update DailyLogModels set AppModelID={ID} where ProcessName='{Name}'");
sqlList.Add($"update HoursLogModels set AppModelID={ID} where ProcessName='{Name}'"); sqlList.Add($"update HoursLogModels set AppModelID={ID} where ProcessName='{Name}'");
sqlList.Add($"update AppModels set IconFile='{icon}' where ID={ID}"); sqlList.Add($"update AppModels set IconFile='{icon}' where ID={ID}");
...@@ -316,6 +318,20 @@ namespace Core.Librarys.SQLite ...@@ -316,6 +318,20 @@ namespace Core.Librarys.SQLite
} }
private string SQLiteEscape(string str)
{
str = str.Replace("/", "//");
str = str.Replace("'", "''");
str = str.Replace("[", "/[");
str = str.Replace("]", "/]");
str = str.Replace("%", "/%");
str = str.Replace("&", "/&");
str = str.Replace("_", "/_");
str = str.Replace("(", "/(");
str = str.Replace(")", "/)");
return str;
}
#region 是否需要处理 #region 是否需要处理
/// <summary> /// <summary>
/// 判断是否需要处理数据,比对core程序集版本号 /// 判断是否需要处理数据,比对core程序集版本号
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment