Skip to content

Instantly share code, notes, and snippets.

@hacksoldier
Created November 19, 2013 09:34
Show Gist options
  • Save hacksoldier/7542733 to your computer and use it in GitHub Desktop.
Save hacksoldier/7542733 to your computer and use it in GitHub Desktop.
[DATABASE] Insert New Record
- (void) insertRecordWithWeight:(float)weight date:(double)date {
int countOfDb = 0;
countOfDb = [self countOfDb];
NSString *sql = [NSString stringWithFormat:@"INSERT OR REPLACE INTO '%@' ('%@','%@','%@')"
"VALUES ('%d','%f','%f')", TABLE_NAME, @"id",FIELD_WEIGHT, FIELD_DATE, countOfDb, weight, date];
char *err;
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) {
sqlite3_close(db);
NSLog(@"****** Not Posssible Insert New Record In %@, with error: '%s'", TABLE_NAME,err);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment