AddToBatch() private method

private AddToBatch ( MySqlCommand command ) : void
command MySqlCommand
return void
コード例 #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);
        }
コード例 #2
0
ファイル: MySqlDataAdapter.cs プロジェクト: Jackjet/ECOSingle
        protected override int ExecuteBatch()
        {
            int num = 0;
            int i   = 0;

            while (i < this.commandBatch.Count)
            {
                MySqlCommand mySqlCommand = (MySqlCommand)this.commandBatch[i++];
                int          j            = i;
                while (j < this.commandBatch.Count)
                {
                    MySqlCommand mySqlCommand2 = (MySqlCommand)this.commandBatch[j];
                    if (mySqlCommand2.BatchableCommandText == null || mySqlCommand2.CommandText != mySqlCommand.CommandText)
                    {
                        break;
                    }
                    mySqlCommand.AddToBatch(mySqlCommand2);
                    j++;
                    i++;
                }
                num += mySqlCommand.ExecuteNonQuery();
            }
            return(num);
        }