Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Last active August 29, 2015 14:02
Show Gist options
  • Save masayuki5160/ae0d3150ba061fd6651e to your computer and use it in GitHub Desktop.
Save masayuki5160/ae0d3150ba061fd6651e to your computer and use it in GitHub Desktop.
#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
@masayuki5160
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment