Created
October 28, 2011 10:58
-
-
Save nickfox/1322066 to your computer and use it in GitHub Desktop.
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
NSString *path = [self filePath]; | |
if (sqlite3_open([path UTF8String], &db) == SQLITE_OK) { | |
NSString *sql = [NSString stringWithFormat: | |
@"INSERT INTO tripfees (tripFeeID, fromAirportID, toAirportID, classID, airlineID, dateOfFlight) VALUES (NULL, %d, %d, %d, %d, '%@')", | |
fromAirportID, toAirportID, classID, airlineID, dateOfFlight]; | |
NSLog(@"sql: %@", sql); | |
// now execute sql statement | |
if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, NULL) != SQLITE_DONE) { | |
NSAssert1(0, @"Error updating tripfees: %s", sqlite3_errmsg(db)); | |
} | |
} else { | |
sqlite3_close(db); | |
NSAssert1(0, @"failed to open database with message '%s'.", sqlite3_errmsg(db)); | |
// more error handling? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment