On Monday, 31 December, 2018 13:48, Simon Slavin <slav...@bigfraud.org> wrote:

>On 31 Dec 2018, at 8:18pm, Jesse Rittner <rittneje+sql...@gmail.com> wrote:

>> I'm trying to write a function to run a query with a timeout. If
>> the timeout expires, the query must stop execution within a "reasonable" 
>> amount
>> of time.

>There is no rule that you must continue to call sqlite3_step() until
>it runs out of rows.  You can calculate an "end time" yourself, check
>it each time you're ready to call sqlite3_step(), and jump straight
>to sqlite3_finalize() if your time is up.

>No threads, no interrupts, no clearup of hooks.

This will not work for queries which do not return rows immediately.  The query 
may be trying to calculate the meaning of life and take quite a while before 
returning its result (and the query writer may not have had the benefit of 
reading The Guide and knowing that the answer is 42 and writing the query as 
SELECT 42; and instead resorted to brute force methods taking many aeons to 
compute).

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.





_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to