Created
November 19, 2013 09:33
-
-
Save hacksoldier/7542717 to your computer and use it in GitHub Desktop.
[DATABASE] Create Table
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
- (void)createTableNamed:(NSString *)tableName{ | |
char *err; | |
NSString *sql = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS '%@' ('%@' " | |
"INTEGER PRIMARY KEY, '%@' REAL, '%@' REAL);", tableName, @"id", FIELD_WEIGHT , FIELD_DATE]; | |
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) { | |
sqlite3_close(db); | |
NSLog(@"Table %@ falied create.", tableName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment