Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><p>What value is <code>sqlite3_step</code> returning? Put in a <code>NSLog</code> statement right before your <code>sqlite3_step</code> (and display the <code>numberOfRetries</code>). You later imply that it's hanging at the <code>sqlite3_step</code> function call, which seems unlikely.</p></li> <li><p>More likely, this routine is repeatedly calling <code>sqlite3_step</code> (e.g. if the database is busy and <code>[parentDB busyRetryTimeout]</code> is 0, this function would never end (or at least until the database contention was resolved). That's the only obvious problem that's leaping out at me, but it requires a confluence of multiple factors.</p></li> <li><p>Why is your database busy? Trying to use it in a background queue? Personally, for my apps that require background database operation, I create a separate <a href="https://developer.apple.com/library/mac/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html#//apple_ref/doc/uid/TP40008091-CH102-SW1" rel="nofollow">serial queue</a> in <a href="https://developer.apple.com/library/mac/#documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html" rel="nofollow">GCD</a> queue for my database operations which, because it's serial, ensures that there is no database contention. Incidentally, if you ever want to get out of the weeds of SQLite programming, <a href="https://github.com/ccgus/fmdb" rel="nofollow">FMDB</a> is a wonderful wrapper, and it has a <code>FMDatabaseQueue</code> which takes care of all of this for you. If my conjecture of point 2 is right, you need to fix that first, but in general, FMDB simplifies background operations on databases.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload