Skip to content

Commit

Permalink
修复切换数据库bug.
Browse files Browse the repository at this point in the history
修复切换数据库bug.
  • Loading branch information
huangzhibiao committed May 10, 2018
1 parent a685b01 commit c83bb24
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 12 deletions.
2 changes: 1 addition & 1 deletion BGFMDB.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "BGFMDB"
s.version = "2.0.7"
s.version = "2.0.8"
s.summary = "完美支持iOS大部分类型数据的存储,同时带有 字典转模型 功能模块."

# This description is used to generate tags and improve search results.
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BGFMDB/ViewController.m"
timestampString = "547375856.0714869"
timestampString = "547616983.575495"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "412"
endingLineNumber = "412"
startingLineNumber = "417"
endingLineNumber = "417"
landmarkName = "-testT"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -84,11 +84,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BGFMDB/ViewController.m"
timestampString = "547375856.071879"
timestampString = "547616983.575909"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "193"
endingLineNumber = "193"
startingLineNumber = "198"
endingLineNumber = "198"
landmarkName = "-viewDidLoad"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -100,12 +100,91 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BGFMDB/libs/BG/BGDB.m"
timestampString = "547380507.667094"
timestampString = "547616983.5761631"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1554"
endingLineNumber = "1554"
landmarkName = "-insertWithObject:ignoredKeys:complete:"
startingLineNumber = "1562"
endingLineNumber = "1562"
landmarkName = "-getArray:ignoredKeys:filtModelInfoType:"
landmarkType = "7">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[BGDB getArray:ignoredKeys:filtModelInfoType:]"
moduleName = "BGFMDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/biao/Documents/GitHub/BGFMDB/BGFMDB/libs/BG/BGDB.m"
timestampString = "547616983.640916"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1562"
endingLineNumber = "1562"
offsetFromSymbolStart = "136">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__47-[BGDB getArray:ignoredKeys:filtModelInfoType:]_block_invoke"
moduleName = "BGFMDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/biao/Documents/GitHub/BGFMDB/BGFMDB/libs/BG/BGDB.m"
timestampString = "547616983.642628"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1562"
endingLineNumber = "1562"
offsetFromSymbolStart = "24">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__destroy_helper_block_.656"
moduleName = "BGFMDB"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/biao/Documents/GitHub/BGFMDB/BGFMDB/libs/BG/BGDB.m"
timestampString = "547616983.644307"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1562"
endingLineNumber = "1562"
offsetFromSymbolStart = "20">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BGFMDB/libs/BG/BGDB.m"
timestampString = "547616983.576219"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "111"
endingLineNumber = "111"
landmarkName = "-queue"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BGFMDB/libs/BG/BGDB.m"
timestampString = "547616983.5764869"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "77"
endingLineNumber = "77"
landmarkName = "-closeDB"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
Expand Down
7 changes: 6 additions & 1 deletion BGFMDB/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ - (void)viewDidLoad {
bg_setDebug(YES);//打开调试模式,打印输出调试信息.

/**
如果频繁操作数据库时,建议进行此设置(即在操作过程不关闭数据库);
如果频繁操作数据库时,建议进行此设置(即在操作过程不关闭数据库).
*/
//bg_setDisableCloseDB(YES);

/**
手动关闭数据库(如果设置了bg_setDisableCloseDB(YES),则在切换bg_setSqliteName前,需要手动关闭数据库一下).
*/
//bg_closeDB();

/**
自定义数据库名称,否则默认为BGFMDB
*/
Expand Down
4 changes: 4 additions & 0 deletions BGFMDB/libs/BG/BGFMDBConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ extern BOOL bg_deleteSqlite(NSString*_Nonnull sqliteName);
默认是NO.
*/
extern void bg_setDisableCloseDB(BOOL disableCloseDB);
/**
手动关闭数据库.
*/
extern void bg_closeDB();
/**
设置调试模式
@debug YES:打印调试信息, NO:不打印调试信息.
Expand Down
9 changes: 9 additions & 0 deletions BGFMDB/libs/BG/BGTool.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ void bg_setDisableCloseDB(BOOL disableCloseDB){
[BGDB shareManager].disableCloseDB = disableCloseDB;
}
}
/**
手动关闭数据库.
*/
void bg_closeDB(){
BOOL closeFlag = [BGDB shareManager].disableCloseDB;
[BGDB shareManager].disableCloseDB = NO;
[[BGDB shareManager] closeDB];
[BGDB shareManager].disableCloseDB = closeFlag;
}
/**
设置调试模式
@debug YES:打印调试信息, NO:不打印调试信息.
Expand Down

0 comments on commit c83bb24

Please sign in to comment.