Commit fb7cdf6d authored by 潘栩锋's avatar 潘栩锋 🚴

1. SQLiteContext ,加载数据异常时,先备份数据库。

2. SQLiteContext 允许只读模式 InitNoBuild()
parent 01c81adc
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -121,6 +122,11 @@ namespace SQLite
if (!isVaild)//不合法
{
if (results.Any(kv => kv.Value == SQLiteHelper.IsTableValidResult.FormatErr))
{
//先备份
File.Copy(DBPath, DBPath + $".{DateTime.Now:yyyyMMddHHmmss}.bk");
}
//有表 不对
foreach (var kv in results)
{
......
......@@ -789,6 +789,7 @@ namespace SQLite
if (!tableInfo0.Equals(tableInfo1))
{
ErrorMsg = $"sqlite_master 找到 name = '{tablename}' 的 sql 不符合要求, " + tableInfo0.ErrorMsg;
results.Add(tablename, IsTableValidResult.FormatErr);
continue;
}
......
Markdown is supported
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