AKYSqlite
安装
AKYSqlite 可通过 CocoaPods 获取。安装它,只需将以下行添加到您的 Podfile
pod 'AKYSqlite'
导入 AKYSqlite.h
#import <AKYSqlite/AKYSqlite.h>
不想使用 CocoaPods 吗?
将 AKYSqlite/Classes 中的文件复制到您的项目中
导入 AKYSqlite.h
#import "AKYSqlite.h"
用法
NSString *dbPath = @"/path/to/the/database/file";
AKYDatabase *db = [AKYDatabase databaseAtPath:dbPath];
[db open];
AKYStatement *stmt = [db prepareStatement:@"SELECT name, lastname FROM person WHERE person_id = $id"];
if (stmt != nil) {
[stmt bindInteger:1 forName:@"$id"];
while ([stmt step]) {
NSString *name = [stmt getStringforName:@"name"];
NSString *lastname = [stmt getStringOrDefaultforName:@"lastname"];
}
[stmt finalize];
}
[db close];
作者
Aikyuichi,[email protected]
许可证
AKYSqlite可在MIT许可下使用。更多信息请参阅LICENSE文件。