Created
May 31, 2013 19:37
-
-
Save katsuhide/5687441 to your computer and use it in GitHub Desktop.
SQLite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DB設定情報 | |
NSString *databaseName = @"main.db"; | |
NSString *path = @"/tmp"; | |
NSString *databasePath = [path stringByAppendingPathComponent:databaseName]; | |
FMDatabase *db = [FMDatabase databaseWithPath:databasePath]; | |
// Query | |
NSString *sql = @"select hoge1, hoge2 participants from hoge;"; | |
// Open DB | |
[db open]; | |
// Execute Query | |
FMResultSet *results = [db executeQuery:sql]; | |
// Output | |
while ([results next]) { | |
NSLog(@"%@, %@", [results stringForColumn:@"hoge1"], [results stringForColumn:@"hoge2"]); | |
} | |
// Release result set | |
[results close]; | |
// Close DB | |
[db close]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment