URMGIT / mybatisnet

Automatically exported from code.google.com/p/mybatisnet
0 stars 0 forks source link

R15 Command Timeout maybe not fixed #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have checked only code change, I do not try to it run or test, 
but I think, that there is still a problem in fix revision 15.

http://code.google.com/p/mybatisnet/source/detail?r=15
 in method   CreateCommand - see bellow

there is a new line:
command.CommandTimeout = _dataSource.DbProvider.DbCommandTimeout;

which set command-timeout from provider setting. OK

But in case of connection is not null, following lines in this method set it 
back to 
connection timeout:

if (_connection!= null)
{
try // MySql provider doesn't suppport it !
{
 command.CommandTimeout = _connection.ConnectionTimeout;
}
....
----------------------------------------------------------
<code>
public IDbCommand CreateCommand(CommandType commandType)
        {
IDbCommand command = _dataSource.DbProvider.CreateCommand();
command.CommandTimeout = _dataSource.DbProvider.DbCommandTimeout;
command.CommandType = commandType;
command.Connection = _connection;

// Assign transaction
if (_transaction != null)
{
try
{
  command.Transaction = _transaction;
}
catch 
{}
}
// Assign connection timeout
if (_connection!= null)
{
try // MySql provider doesn't suppport it !
{
 command.CommandTimeout = _connection.ConnectionTimeout;
}
catch(NotSupportedException e)
{
if (_logger.IsInfoEnabled)
{
_logger.Info(e.Message);
}
}
}

//          if (_logger.IsDebugEnabled)
//          {
//command = IDbCommandProxy.NewInstance(command);
//          }

return command;
}

</code>

Original issue reported on code.google.com by dmu...@gmail.com on 25 Aug 2010 at 9:53