Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
fb7cdf6d
Commit
fb7cdf6d
authored
Sep 17, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. SQLiteContext ,加载数据异常时,先备份数据库。
2. SQLiteContext 允许只读模式 InitNoBuild()
parent
01c81adc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
SQLiteDbContext.cs
Project.SQLiteHelper/SQLiteHelper/SQLiteDbContext.cs
+6
-0
SQLiteHelper.cs
Project.SQLiteHelper/SQLiteHelper/SQLiteHelper.cs
+1
-0
No files found.
Project.SQLiteHelper/SQLiteHelper/SQLiteDbContext.cs
View file @
fb7cdf6d
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
)
{
...
...
Project.SQLiteHelper/SQLiteHelper/SQLiteHelper.cs
View file @
fb7cdf6d
...
...
@@ -789,6 +789,7 @@ namespace SQLite
if
(!
tableInfo0
.
Equals
(
tableInfo1
))
{
ErrorMsg
=
$"sqlite_master 找到 name = '
{
tablename
}
' 的 sql 不符合要求, "
+
tableInfo0
.
ErrorMsg
;
results
.
Add
(
tablename
,
IsTableValidResult
.
FormatErr
);
continue
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment