Overview
Features
Download
Documentation
Community
Add-Ons & Services

Setting SQLite busy timeout

Please post support and help requests here.

Setting SQLite busy timeout

Postby rd » 05 Jul 2007, 11:48

Hi,

I get a lot of SQLite::DBLockedException exceptions when using Poco in a multithreaded application.

It seems there's no way to prevent this using the current interface, so I added the following code:

SQLite SessionImpl.h:

private:
void setBusyTimeout(const std::string& name, const Poco::Any& value);
/// sets busy handler that sleeps for a while when a table is locked

SQLite SessionImpl.cpp:

SessionImpl::SessionImpl(const std::string& fileName):
_dbFileName(fileName),
_pDB(0),
_connected(false)
{
addProperty("busytimeout",
&SessionImpl::setBusyTimeout,
NULL);
open();
}


void SessionImpl::setBusyTimeout(const std::string& name, const Poco::Any& value)
{
poco_check_ptr (_pDB);
sqlite3_busy_timeout(_pDB, Poco::RefAnyCast(value));
}


Could you add this to the library? Or is there a better way to handle database busy errors?

Thanks,

Ronny
rd
 
Posts: 19
Joined: 16 Jun 2007, 15:30

Re: Setting SQLite busy timeout

Postby guenter » 09 Jul 2007, 11:53

I'll add this to the next release.
guenter
 
Posts: 1129
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests