Ejemplo n.º 1
0
        protected virtual void BindParameters()
        {
            MySqlParameterCollection parameters = this.command.Parameters;
            int num = 0;

            do
            {
                this.InternalBindParameters(this.ResolvedCommandText, parameters, null);
                if (this.command.Batch != null)
                {
                    while (num < this.command.Batch.Count)
                    {
                        MySqlCommand command = this.command.Batch[num++];
                        MySqlStream  stream  = (MySqlStream)this.buffers[this.buffers.Count - 1];
                        long         num2    = command.EstimatedSize();
                        if ((stream.InternalBuffer.Length + num2) > this.Connection.driver.MaxPacketSize)
                        {
                            parameters = command.Parameters;
                            break;
                        }
                        this.buffers.RemoveAt(this.buffers.Count - 1);
                        long   length = stream.InternalBuffer.Length;
                        string batchableCommandText = command.BatchableCommandText;
                        if (batchableCommandText.StartsWith("("))
                        {
                            stream.WriteStringNoNull(", ");
                        }
                        else
                        {
                            stream.WriteStringNoNull("; ");
                        }
                        this.InternalBindParameters(batchableCommandText, command.Parameters, stream);
                        if (stream.InternalBuffer.Length > this.Connection.driver.MaxPacketSize)
                        {
                            stream.InternalBuffer.SetLength(length);
                            parameters = command.Parameters;
                            break;
                        }
                    }
                }
                else
                {
                    return;
                }
            }while (num != this.command.Batch.Count);
        }