标签:
https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
https://github.com/yapstudios/YapDatabase/blob/master/YapDatabase/YapDatabase.m
?
?
+ (NSString *)sqliteVersionUsing:(sqlite3 *)aDb
{
sqlite3_stmt *statement;
int status = sqlite3_prepare_v2(aDb, "SELECT sqlite_version();", -1, &statement, NULL);
if (status != SQLITE_OK)
{
YDBLogError(@"%@: Error creating statement! %d %s", THIS_METHOD, status, sqlite3_errmsg(aDb));
return nil;
}
NSString *version = nil;
status = sqlite3_step(statement);
if (status == SQLITE_ROW)
{
const unsigned char *text = sqlite3_column_text(statement, SQLITE_COLUMN_START);
int textSize = sqlite3_column_bytes(statement, SQLITE_COLUMN_START);
version = [[NSString alloc] initWithBytes:text length:textSize encoding:NSUTF8StringEncoding];
}
else
{
YDBLogError(@"%@: Error executing statement! %d %s", THIS_METHOD, status, sqlite3_errmsg(aDb));
}
sqlite3_finalize(statement);
statement = NULL;
return version;
}
标签:
原文地址:http://www.cnblogs.com/huahuahu/p/iOS-zhongsqlite-ban-ben-hao.html