Skip to content

Instantly share code, notes, and snippets.

@hacksoldier
Created November 19, 2013 09:33
Show Gist options
  • Save hacksoldier/7542717 to your computer and use it in GitHub Desktop.
Save hacksoldier/7542717 to your computer and use it in GitHub Desktop.
[DATABASE] Create Table
- (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