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
2542c75e
Commit
2542c75e
authored
Jul 28, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 SQLite 按时间删除数据库时,顺便压缩数据库
parent
aec000a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
SQLiteDbContext.cs
Project.SQLiteHelper/SQLiteHelper/SQLiteDbContext.cs
+5
-1
No files found.
Project.SQLiteHelper/SQLiteHelper/SQLiteDbContext.cs
View file @
2542c75e
...
@@ -258,7 +258,10 @@ namespace SQLite
...
@@ -258,7 +258,10 @@ namespace SQLite
if
(
sqls
.
Count
==
0
)
if
(
sqls
.
Count
==
0
)
return
;
return
;
sqliteHelper
.
QueryTran
(
sqls
);
if
(
sqliteHelper
.
QueryTran
(
sqls
))
{
//数据库压缩
sqliteHelper
.
ExecuteNonQuery
(
"VACUUM"
);
}
}
}
...
@@ -387,6 +390,7 @@ namespace SQLite
...
@@ -387,6 +390,7 @@ namespace SQLite
//把sqls里面为空的全部删除
//把sqls里面为空的全部删除
if
(
sqliteHelper2
.
QueryTran
(
sqls
))
{
if
(
sqliteHelper2
.
QueryTran
(
sqls
))
{
//数据库压缩
sqliteHelper2
.
ExecuteNonQuery
(
"VACUUM"
);
sqliteHelper2
.
ExecuteNonQuery
(
"VACUUM"
);
}
}
...
...
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