Skip to content

Instantly share code, notes, and snippets.

@nickfox
Created October 28, 2011 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickfox/1322073 to your computer and use it in GitHub Desktop.
Save nickfox/1322073 to your computer and use it in GitHub Desktop.
NSString *path = [self filePath];
if (sqlite3_open([path UTF8String], &db) == SQLITE_OK) {
NSString *sql = [NSString stringWithFormat:
@"INSERT INTO tripfees (fromAirportID, toAirportID, classID, airlineID, dateOfFlight) VALUES (%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?
}
2011-10-28 04:09:03.837 iflybags[49714:b303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error updating tripfees: not an error'
*** Call stack at first throw:
(
0 CoreFoundation 0x00e605a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00fb4313 objc_exception_throw + 44
2 CoreFoundation 0x00e18ef8 +[NSException raise:format:arguments:] + 136
3 Foundation 0x008b53bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 iflybags 0x0000354a -[DatabaseController insertTripFeeWithDateOfFlight:withFromAirportID:withToAirportID:withClassID:withAirlineID:] + 554
5 iflybags 0x00002e18 -[iflybagsViewController viewDidLoad] + 264
6 UIKit 0x00162089 -[UIViewController view] + 179
7 UIKit 0x000d5d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
8 iflybags 0x0000296b -[iflybagsAppDelegate application:didFinishLaunchingWithOptions:] + 235
9 UIKit 0x000b2c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
10 UIKit 0x000b4d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
11 UIKit 0x000bf617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x000b7abf -[UIApplication sendEvent:] + 71
13 UIKit 0x000bcf2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x010f6992 PurpleEventCallback + 1550
15 CoreFoundation 0x00e41944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00da1cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00d9ef83 __CFRunLoopRun + 979
18 CoreFoundation 0x00d9e840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00d9e761 CFRunLoopRunInMode + 97
20 UIKit 0x000b47d2 -[UIApplication _run] + 623
21 UIKit 0x000c0c93 UIApplicationMain + 1160
22 iflybags 0x00002849 main + 121
23 iflybags 0x000027c5 start + 53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment