mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 22:31:23 +01:00
Merge pull request #517 from cristiantm/enh-sqlite-timeoutProperty
Adding timeout as property on SQLite
This commit is contained in:
commit
e30ff7dd8c
@ -117,6 +117,10 @@ public:
|
||||
const std::string& connectorName() const;
|
||||
/// Returns the name of the connector.
|
||||
|
||||
protected:
|
||||
void setConnectionTimeout(const std::string& prop, const Poco::Any& value);
|
||||
Poco::Any getConnectionTimeout(const std::string& prop);
|
||||
|
||||
private:
|
||||
std::string _connector;
|
||||
sqlite3* _pDB;
|
||||
|
@ -51,6 +51,7 @@ SessionImpl::SessionImpl(const std::string& fileName, std::size_t loginTimeout):
|
||||
addFeature("autoCommit",
|
||||
&SessionImpl::autoCommit,
|
||||
&SessionImpl::isAutoCommit);
|
||||
addProperty("connectionTimeout", &SessionImpl::setConnectionTimeout, &SessionImpl::getConnectionTimeout);
|
||||
}
|
||||
|
||||
|
||||
@ -212,6 +213,18 @@ void SessionImpl::setConnectionTimeout(std::size_t timeout)
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::setConnectionTimeout(const std::string& prop, const Poco::Any& value)
|
||||
{
|
||||
setConnectionTimeout(Poco::RefAnyCast<std::size_t>(value));
|
||||
}
|
||||
|
||||
|
||||
Poco::Any SessionImpl::getConnectionTimeout(const std::string& prop)
|
||||
{
|
||||
return Poco::Any(_timeout/1000);
|
||||
}
|
||||
|
||||
|
||||
void SessionImpl::autoCommit(const std::string&, bool)
|
||||
{
|
||||
// The problem here is to decide whether to call commit or rollback
|
||||
|
Loading…
x
Reference in New Issue
Block a user