Browse files

Better error messages in logs when running a query

The logged "Error calling sqlite3_step" warning now displays the real
error number and message of the underlying error. (You have to call
sqlite3_reset on the statement to unwrap the real number/message.)
  • Loading branch information...
1 parent be9cbd1 commit bc2f821d9ee76d3aa35cd66ebde8d9dfc89941fb @snej snej committed Dec 21, 2011
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/FMDatabase.m
@@ -725,6 +725,7 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra
// all is well, let's return.
else if (SQLITE_ERROR == rc) {
+ rc = sqlite3_reset(pStmt); // Get the real error code & message
NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_ERROR", rc, sqlite3_errmsg(db));
NSLog(@"DB Query: %@", sql);

0 comments on commit bc2f821

Please sign in to comment.