コード例 #1
0
        protected override int ExecuteBatch()
        {
            int recordsAffected = 0;
            int index           = 0;

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