Search code examples
iosfmdb

FMDB Infinite loop due to sqlite3_step and while (retry)


I have a FMDB executeUpdate which cause an infinite loop :

FMDatabase *db = [FMDatabase databaseWithPath:[CDDBManager getDatabasePath]];

[db closeOpenResultSets];
[db close];
NSLog(@"successfully pass closes");
[db open];
NSLog(@"successfully pass open");
[db setTraceExecution:YES];
BOOL success = [db executeUpdate:@"INSERT OR REPLACE INTO Player (id, ..., is_user) VALUES (?, ..., ?)",
                [NSNumber numberWithInt:self.player_id],
                ...
                [NSNumber numberWithInt:1]];

NSLog(@"end update");
[db close];

I call this method in two different VCs and in one it perfectly work ... in other I have an infinite loop (I print retry in the "do{} while()" of FMDB), so I don't see "end update" ... As you see, I already try to close all result sets and and the db ...

Anyone can see where I've failed ?

All suggestions are welcome.


Solution

  • I'm sorry but it is a simple error in function where I close the FMResultSet after a return in condition clause ...