Thanks Puneet,

I thought so too. But the application that we are working on is kind of heavily 
multi-threaded and needs to be thread safe. 
When we "Begin Transaction", does Sqlite return any kind of unique handle or ID 
which can be used to poll a list of open transactions and kill or cancel the 
transaction if required. I did not find it and I suppose that it does not also.

For e.g. 
Suppose one thread opens a transaction and does some operations. Simultaneously 
another and many other threads open up another transaction. Now for some 
reason, the first transaction query hangs, and does not complete execution. 
This would cause problems! So to come out of this, we would need a unique 
transaction id to kill it. Is there a way to achieve this or is there a better 
way to do this?

Thanks & Regards,
Sachin Gupta

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Puneet Kishor
Sent: Wednesday, December 29, 2010 10:40 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Cancel execution of a executing Query



Sachin Gupta wrote:
> Hi,
>
> Suppose that there is a query executing on the in memory Database which I 
> have executed. Now in my application, I want the user to have the 
> functionality to be able to cancel the ongoing query depending on certain 
> scenarios.
>

You could use transactions, and, as long as it is not committed, you 
could rollback the query if desired. Of course, you would have to design 
your application accordingly, to provide the interface for the user to 
"cancel" the query or "approve" it, and only then either rollback or 
commit, as appropriate.


But, you do realize that most queries usually execute within 
milliseconds. Unless you have some mongo query that takes longer time 
than most human key-pressing, reaction time, using transactions and 
rolling them back is probably what you are looking for.

> How can I achieve the same?
>
> Thanks&  Regards,
> Sachin Gupta
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to