internal bool SetCommandTimeout(int value)
{
if (!hasBeenOpen)
// Connection timeout is handled by driver
return false;
if (commandTimeout != 0)
// someone is trying to set a timeout while command is already
// running. It could be for example recursive call to ExecuteReader
// Ignore the request, as only top-level (non-recursive commands)
// can set timeouts.
return false;
if (driver == null)
return false;
commandTimeout = value;
driver.ResetTimeout(commandTimeout * 1000);
return true;
}