Ejemplo n.º 1
0
        protected override int ExecuteBatch()
        {
            int recordsAffected = 0;
            int index           = 0;

            while (index < commandBatch.Count)
            {
                MySqlCommand cmd = (MySqlCommand)commandBatch[index++];
                for (int index2 = index; index2 < commandBatch.Count; index2++, index++)
                {
                    MySqlCommand cmd2 = (MySqlCommand)commandBatch[index2];
                    if (cmd2.BatchableCommandText == null ||
                        cmd2.CommandText != cmd.CommandText)
                    {
                        break;
                    }
                    cmd.AddToBatch(cmd2);
                }
                recordsAffected += cmd.ExecuteNonQuery();
            }
            return(recordsAffected);
        }