Last active
August 29, 2015 14:02
-
-
Save masayuki5160/ae0d3150ba061fd6651e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#import "ViewController.h" | |
#import "FMDB.h" // FMDBのimport | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ | |
NSBundle *bundle = [NSBundle mainBundle]; | |
NSString *path2 = [bundle bundlePath]; | |
NSLog(@"test %@", path2); | |
NSString *path = [path2 stringByAppendingString:@"/Data/Raw/test.db"]; | |
FMDatabase *db = [FMDatabase databaseWithPath:path]; | |
NSString *sql = @"CREATE TABLE IF NOT EXISTS test (user_id INTEGER PRIMARY KEY, user_name TEXT);"; | |
[db open]; | |
// [db setKey:@""];// 暗号化しているとき | |
[db executeQuery:sql]; | |
[db close]; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://obc-fight.blogspot.jp/2012/09/fmdb-basic-how-to-use.html