Bug #74135 MySqlScript does not have a CommandTimeout property
Submitted: 29 Sep 2014 12:59 Modified: 22 Oct 2014 19:29
Reporter: Vilhelm Heiberg Email Updates:
Status: Analyzing Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:Microsoft Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: MySqlScript timeout

[29 Sep 2014 12:59] Vilhelm Heiberg
Description:
The MySqlScript class is a wrapper around the MySqlCommand class.
The MySqlCommand class has the property CommandTimeout.
My request is the extend the MySqlScript class to have the property CommandTimeout to be able to execute timeconsuming scripts.

I have peeked at the code of the MySqlScript class, and this seems like a very easy thing to implement.

How to repeat:

 using (MySqlConnection connection = new MySqlConnection(this._connectionstring))
                {
                    connection.Open();
                    MySqlScript cmd = new MySqlScript(connection, script);
                    cmd.Error += new MySqlScriptErrorEventHandler(cmd_Error);
                    return cmd.Execute();
                }

Suggested fix:
Inside the Execute() method of the MySqlScript class set the CommandTimeout of the MySqlCommand object after it is initialized.
[22 Oct 2014 19:31] Fernando Gonzalez.Sanchez
Thanks for your bug report.

Yes, it is easy to verify this.

The current workaround is to set the "DefaultCommandTimeout" in the connection string passed to the desired value.

The MySqlCommand takes its default value from there.