stopping a sqlite sqlselect command

Anyone know if there is a way in a thread/timer where I can stop/abort a long sqlite sqlselect statement?

Maybe put it in a Thread and kill it?

A safer way would be to call the sqlite function sqlite3_interrupt():

To call that function, you need the db reference. To get to that, see

Not easy to do. However, if one person gets it working, others may benefit from it.

anyone figure out a good way to implement this?

Dave, have you attempted my approach? All the information is there, I think, so you could simply copy and modify. I haven’t tried myself, though.

Thomas… and what approach is that?

makes me assume it is all theoretical… .

Maybe I’ve forgotten that there are some more complicated challenges, but unless that’s the case, the steps are pretty simple:

Use my demo project, which contains a module named “TTsSQLiteCustomFunctions”, in which it already declares a lot of functions for calling into the sqlite lib. You may only have to find the right function number for sqlite3_interrupt and add a Xojo function to the module.

Then load the sqlite3_xojo_hook to get access to the function calls and call the sqlite3_interrupt function as needed.

The ICU extension (and related module) can simply be removed as it’s not needed for this.


The only demo program does an uppercase on dim testText as String = “Tte–Tte”

even so… you cannot issue any command if the SQLite engine is already busy doing the Select?

The demo prj would help you adding a function to initiate the interrupt, stopping the currently processed command.

You’ll have to run either the query from a thread or run a thread that detects when the sql cmd should be cancelled, and then issue that function call.

So the answer to my original question[quote=331084:@Dave S]anyone figure out a good way to implement this?[/quote]
is yes, you figured it out… but no you (nor anyone) has done it

I read thru you code and it looks like such a “function” would need be “C”… and that is out of my scope…

I’m sorry now I have wasted 6 weeks working on this project… unfortuantly I made some incorrect assumptions about OFFSET and LIMIT …

Actually, the module I mentioned only needs to have one of the other functions duplicates, those that call into the sqlite lib, and replace the function number, which has to be learned from the sqlite header (.h) file.

I’m glad you pointed that out to me. I’ve since done some extensive research but haven’t really been able to find a solution that works when you can’t control the where and order by clauses.

I would be interested in finding out more.

Here a few things that looked interesting to me. (I do not have the experience to know if this is even possible in Xojo)