Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
f4401f8b
Commit
f4401f8b
authored
Nov 18, 2015
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize DBHelper
parent
a57d631e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
29 deletions
+30
-29
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
...main/scala/com/github/shadowsocks/database/DBHelper.scala
+30
-29
No files found.
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
View file @
f4401f8b
...
...
@@ -65,35 +65,36 @@ class DBHelper(val context: Context)
if
(
oldVersion
<
7
)
{
profileDao
.
executeRawNoArgs
(
"DROP TABLE IF EXISTS 'profile';"
)
onCreate
(
database
,
connectionSource
)
}
else
{
if
(
oldVersion
<
8
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR;"
)
}
if
(
oldVersion
<
9
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR;"
)
}
if
(
oldVersion
<
10
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN auth SMALLINT;"
)
}
if
(
oldVersion
<
11
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN ipv6 SMALLINT;"
)
}
if
(
oldVersion
<
12
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` RENAME TO `tmp`;"
)
onCreate
(
database
,
connectionSource
)
profileDao
.
executeRawNoArgs
(
"INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, proxyApps, bypass,"
+
" udpdns, auth, ipv6, individual) "
+
"SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, auth,"
+
" ipv6, individual FROM `tmp`;"
)
profileDao
.
executeRawNoArgs
(
"DROP TABLE `tmp`;"
)
}
if
(
oldVersion
<
13
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN tx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN rx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN date DATE;"
)
}
return
}
if
(
oldVersion
<
8
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR;"
)
}
if
(
oldVersion
<
9
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN route VARCHAR;"
)
}
if
(
oldVersion
<
10
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN auth SMALLINT;"
)
}
if
(
oldVersion
<
11
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN ipv6 SMALLINT;"
)
}
if
(
oldVersion
<
12
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` RENAME TO `tmp`;"
)
onCreate
(
database
,
connectionSource
)
profileDao
.
executeRawNoArgs
(
"INSERT INTO `profile`(id, name, host, localPort, remotePort, password, method, route, proxyApps, bypass,"
+
" udpdns, auth, ipv6, individual) "
+
"SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, auth,"
+
" ipv6, individual FROM `tmp`;"
)
profileDao
.
executeRawNoArgs
(
"DROP TABLE `tmp`;"
)
return
}
if
(
oldVersion
<
13
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN tx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN rx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN date DATE;"
)
}
}
}
...
...
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