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
}
Could you add this to the library? Or is there a better way to handle database busy errors?
Thanks,
Ronny





