MySql.Data.MySqlClient.MySqlCommand.AddToBatch C# (CSharp) Method

AddToBatch() private method

private AddToBatch ( MySqlCommand command ) : void
command MySqlCommand
return void
        internal void AddToBatch(MySqlCommand command)
        {
            if (batch == null)
                batch = new List<MySqlCommand>();
            batch.Add(command);
        }

Usage Example

コード例 #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.CommandText != cmd.CommandText)
                    {
                        break;
                    }
                    cmd.AddToBatch(cmd2);
                }
                recordsAffected += cmd.ExecuteNonQuery();
            }
            return(recordsAffected);
        }
All Usage Examples Of MySql.Data.MySqlClient.MySqlCommand::AddToBatch