SQLite Forum

Cancelling the query
Login
In this case I suggest you handle the matter inside your application programming rather than using SQLite to do it.  Set a flag when the user presses the key, and check that flag each time through your call of <code>_step()</code>.

The thing that makes me think this is that you're using <code>_step()</code>, and that the query is done frequently.  Presumably you've optimized the query: it has an ideal index and no one call to <code>_step()</code> takes much time.  So checking for the flag each time you call <code>_step()</code> won't ever cause much delay.

<code>sqlite3_interrupt()</code> can be very useful for unpredictably queries on huge databases which might take unpredictable times.  It can also be useful if you are using <code>_exec()</code> and can't check progress every time through the <code>_step()</code> loop.  But in this case you have superior control and superior knowledge about what's going on and can use this to your advantage.