Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » sqlite busy/lock timeout patch
sqlite busy/lock timeout patch [message #25936] Sat, 20 March 2010 22:34 Go to next message
zsolt is currently offline  zsolt
Messages: 579
Registered: December 2005
Location: Budapest, Hungary
Contributor
I had a lot of problems with sqlite in a multi threaded and multi process environment.

It is possible to set a busy handler on a db handle using sqlite3 API, but it is able to handle SQLITE_BUSY only. The problem is, that sometimes I got SQLITE_LOCKED, but in this case, I had to reset the statement be able to successfully retry.

So I modified U++ sqlite classes, to handle a timeout.

You can set negative value as timeout if you need infinite wait. Infinite is dangerous for more than one thread, as you can get infinite deadlock that way.

I don't know if this workaround fits into U++, but I attached the patch.
Re: sqlite busy/lock timeout patch [message #26028 is a reply to message #25936] Fri, 26 March 2010 15:34 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 579
Registered: December 2005
Location: Budapest, Hungary
Contributor
Any ideas?
Re: sqlite busy/lock timeout patch [message #26039 is a reply to message #26028] Fri, 26 March 2010 18:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11956
Registered: November 2005
Ultimate Member
It is OK with.

Can you please post it as plain files? I do not have tools to apply this .patch format automatically.

Mirek
Re: sqlite busy/lock timeout patch [message #26049 is a reply to message #26039] Fri, 26 March 2010 22:36 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 579
Registered: December 2005
Location: Budapest, Hungary
Contributor
Yes, I uploaded them.

Btw, you can place this patch into plugin/sqlite3 directory and use Tortoise SVN's Apply Patch menu.
  • Attachment: Sqlite3.h
    (Size: 1.65KB, Downloaded 179 times)
  • Attachment: Sqlite3upp.cpp
    (Size: 13.49KB, Downloaded 366 times)
Re: sqlite busy/lock timeout patch [message #26067 is a reply to message #26049] Sun, 28 March 2010 20:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11956
Registered: November 2005
Ultimate Member
zsolt wrote on Fri, 26 March 2010 17:36


Btw, you can place this patch into plugin/sqlite3 directory and use Tortoise SVN's Apply Patch menu.


I know, but I do not want to install Tortoise - afraid of getting out of sync with SilkSVN...
Re: sqlite busy/lock timeout patch [message #26084 is a reply to message #26067] Tue, 30 March 2010 23:10 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 478
Registered: November 2008
Location: France
Senior Member
Hi,

This patch causes compile problems under linux because of ::GetTickCount() and ::Sleep()

the '::' needs to be removed to compile under linux and fallback to the portable Upp functions:
  • Upp::GetTickCount()
  • Upp::SLeep()


Didier
Re: sqlite busy/lock timeout patch [message #26121 is a reply to message #26084] Fri, 02 April 2010 10:42 Go to previous message
mirek is currently offline  mirek
Messages: 11956
Registered: November 2005
Ultimate Member
Fixed, hopefully, by removing "::".
Previous Topic: sqlite and Execute
Next Topic: Questions about sqlite schema
Goto Forum:
  


Current Time: Sat Jul 20 04:56:10 CEST 2019

Total time taken to generate the page: 0.00951 seconds