diff --git a/Data/SQLite/include/Poco/Data/SQLite/SessionImpl.h b/Data/SQLite/include/Poco/Data/SQLite/SessionImpl.h index 1be2dd1e7..769d51f3e 100644 --- a/Data/SQLite/include/Poco/Data/SQLite/SessionImpl.h +++ b/Data/SQLite/include/Poco/Data/SQLite/SessionImpl.h @@ -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; diff --git a/Data/SQLite/src/SessionImpl.cpp b/Data/SQLite/src/SessionImpl.cpp index d3f542a55..07322f071 100644 --- a/Data/SQLite/src/SessionImpl.cpp +++ b/Data/SQLite/src/SessionImpl.cpp @@ -24,6 +24,7 @@ #include "Poco/String.h" #include "Poco/Mutex.h" #include "Poco/Data/DataException.h" +#include "Poco/NumberParser.h" #include "sqlite3.h" #include @@ -51,6 +52,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 +214,19 @@ void SessionImpl::setConnectionTimeout(std::size_t timeout) } +void SessionImpl::setConnectionTimeout(const std::string& prop, const Poco::Any& value) +{ + int timeout = Poco::RefAnyCast(value); + setConnectionTimeout(timeout); +} + + +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