Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
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
张杰
xffruit
Commits
9c6ac187
Commit
9c6ac187
authored
Mar 08, 2016
by
AvatarC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
不同用户:用不同的db
parent
12a6d2cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
GXFFunctionDB.h
XFFruit/Controllers/DataBaseController/GXFFunctionDB.h
+1
-0
GXFFunctionDB.m
XFFruit/Controllers/DataBaseController/GXFFunctionDB.m
+24
-2
ICRLoginViewController.m
XFFruit/ViewControllers/Login/ICRLoginViewController.m
+3
-0
No files found.
XFFruit/Controllers/DataBaseController/GXFFunctionDB.h
View file @
9c6ac187
...
...
@@ -28,6 +28,7 @@
//既有权限又被选择的
-
(
NSArray
*
)
functionsHasPermissionAndIsSelected
;
-
(
void
)
deleteTables
;
#pragma displayFunction
...
...
XFFruit/Controllers/DataBaseController/GXFFunctionDB.m
View file @
9c6ac187
...
...
@@ -30,7 +30,14 @@
-
(
BOOL
)
openDb
{
// NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString
*
path
=
[
NSSearchPathForDirectoriesInDomains
(
NSApplicationSupportDirectory
,
NSUserDomainMask
,
YES
)
lastObject
];
NSString
*
dbPath
=
[
path
stringByAppendingString
:
@"function.db"
];
ICRUserUtil
*
user
=
[
ICRUserUtil
sharedInstance
];
NSString
*
dbPath
;
//= [path stringByAppendingString:@"function.db"];
if
(
user
.
userCode
)
{
dbPath
=
[
NSString
stringWithFormat
:
@"%@%@function.db"
,
path
,
user
.
userCode
];
}
else
{
dbPath
=
[
path
stringByAppendingString
:
@"function.db"
];
}
self
.
dataBase
=
[
FMDatabase
databaseWithPath
:
dbPath
];
CLog
(
@"dbPath = %@"
,
dbPath
);
BOOL
isOpen
=
[
_dataBase
open
];
...
...
@@ -48,8 +55,23 @@
}
-
(
void
)
deleteTables
{
if
([
self
openDb
])
{
[
self
functionTableDelete
];
[
self
displayFunctionTableDelete
];
}
}
-
(
BOOL
)
functionTableDelete
{
NSString
*
delSql
=
@"delete from function"
;
BOOL
work
=
[
_dataBase
executeQuery
:
delSql
];
return
work
;
}
-
(
BOOL
)
displayFunctionTableDelete
{
NSString
*
delSql
=
@"delete from displayFunction"
;
BOOL
work
=
[
_dataBase
executeQuery
:
delSql
];
return
work
;
}
-
(
BOOL
)
functionTableCreate
{
// if (![_dataBase open]) {
// [self openDb];
...
...
XFFruit/ViewControllers/Login/ICRLoginViewController.m
View file @
9c6ac187
...
...
@@ -131,6 +131,7 @@
//#else
//
//#endif
}
#pragma mark - Logic
...
...
@@ -169,8 +170,10 @@
#pragma 可以开新线程 ,待优化
//当登陆成功时就建立功能数据表
// [[GXFFunctionDB sharedInstance] deleteTables];
[[
GXFFunctionDB
sharedInstance
]
createTables
];
//完成对初始化数据书库的操作
if
(
!
[[
GXFFunctionDBHelper
sharedInstance
]
successInsertOriginFunctions
])
{
[[
GXFFunctionDBHelper
sharedInstance
]
insertAllOriginFunctions
];
...
...
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