mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 03:03:23 +02:00
* Fix integer overflow in sessionimpl.cpp * Modify document of setConnectionTimeout Add discription of exception.
This commit is contained in:

committed by
Aleksandar Fabijanic

parent
40324cdcc0
commit
a767d55a81
@@ -75,6 +75,7 @@ public:
|
||||
|
||||
void setConnectionTimeout(std::size_t timeout);
|
||||
/// Sets the session connection timeout value.
|
||||
/// Throws RangeException if the timeout value is overflow.
|
||||
|
||||
std::size_t getConnectionTimeout();
|
||||
/// Returns the session connection timeout value.
|
||||
|
@@ -223,10 +223,18 @@ bool SessionImpl::isConnected()
|
||||
|
||||
void SessionImpl::setConnectionTimeout(std::size_t timeout)
|
||||
{
|
||||
int tout = 1000 * timeout;
|
||||
int rc = sqlite3_busy_timeout(_pDB, tout);
|
||||
if (rc != 0) Utility::throwException(rc);
|
||||
_timeout = tout;
|
||||
if(timeout >= 0 && (timeout <= INT_MAX/1000))
|
||||
{
|
||||
int tout = 1000 * timeout;
|
||||
int rc = sqlite3_busy_timeout(_pDB, tout);
|
||||
if (rc != 0) Utility::throwException(rc);
|
||||
_timeout = tout;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw RangeException
|
||||
("Occurred integer overflow because of timeout value.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user