Latest | 0.1.0 |
---|---|
Homepage | https://github.com/hanl001/HLFMDB |
License | MIT |
Platforms | ios 7.0, requires ARC |
Dependencies | FMDB |
Authors |
- 简介:对FMDB的封装
- 优点:线程安全,简单易用(无需写sql)
使用说明
-
集成到项目
- 支持
cocoapods
: 在podfile
中添加pod 'HLFMDB'
然后执行pod install
- 手动将 Source文件夹 拖入项目
- 支持
-
在项目中导入头文件 :
#import "HLFMDB"
- 基本操作步骤
///1. 判断表是否存在(如果存在则返回YES; 如果不存在则自动创建该表,创建成功仍返回YES,失败则返回NO)
-(BOOL)hl_isExitTableWithName:(NSString *)tableName;
///2. 插入数据
-(BOOL)hl_insertModel:(id)model intoTable:(NSString *)tableName; ///向指定表中插入一条数据(传入model即可)
-(BOOL)hl_insertModelArray:(NSArray<id>*)modelArray
intoTable:(NSString *)tableName; ///向指定表中插入多条数据
///3. 查询数据
-(NSArray *)hl_selectResultArrayWithTableName:(NSString *)tableName
keyArray:(NSArray *)keyArray
whereArray:(NSArray *)whereArray; ///指定条件查询
-(NSArray *)hl_selectAllResultFromTable:(NSString *)tableName; ///查询表中所有数据
///3. 删除操作
-(BOOL)hl_clearTableDataWithTableName:(NSString *)tableName;
上述方法可直接在控制器中调用,基本可满足需要。如果有其他操作需要,可直接使用
HLFMDB
类中的方法(源码中有详细注释)
Latest podspec
{ "name": "HLFMDB", "version": "0.1.0", "summary": "u57fau4e8eFMDBu7684u5c01u88c5", "description": "u4e00u53e5u4ee3u7801u8fdbu884cu589eu5220u6539u67e5", "homepage": "https://github.com/hanl001/HLFMDB", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "hanl001": "[email protected]" }, "platforms": { "ios": "7.0" }, "source": { "git": "https://github.com/hanl001/HLFMDB.git", "tag": "0.1.0" }, "source_files": [ "Classes", "HLFMDB/Source/*.{h,m}" ], "requires_arc": true, "dependencies": { "FMDB": [ "~> 2.6.2" ] } }
Fri, 12 May 2017 10:20:25 +0000