Created
November 19, 2013 09:34
-
-
Save hacksoldier/7542733 to your computer and use it in GitHub Desktop.
[DATABASE] Insert New Record
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) 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