protected override int Update(DataRow[] dataRows, DataTableMapping tableMapping)
{
List<MySqlConnection> connectionsOpened = new List<MySqlConnection>();
try
{
// Open connections for insert/update/update commands, if
// connections are closed.
foreach(DataRow row in dataRows)
{
OpenConnectionIfClosed(row.RowState, connectionsOpened);
}
int ret = base.Update(dataRows, tableMapping);
// Following was a workaround for Bug#54863
// It a good question whether we still needed it, it seems like
// .NET bug (DbDataAdapter not issuing AcceptChanges() for
// modified rows) has already been fixed in .NET
foreach (DataRow row in dataRows)
{
if (row.RowState != DataRowState.Unchanged &&
row.RowState != DataRowState.Detached)
{
row.AcceptChanges();
}
}
return ret;
}
finally
{
foreach(MySqlConnection c in connectionsOpened)
c.Close();
}
}