List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:October 7 2010 9:10pm
Subject:bzr commit into connector-net-6.0 branch (reggie.burnett:840) Bug#56806
View as plain text  
#At file:///C:/work/connector-net/6.0/ based on revid:reggie.burnett@stripped

  840 Reggie Burnett	2010-10-07
      - fixed MySqlCommand.Clone so that the default command timeoout functionality is not disabled when
        you clone a command (bug #56806)
       The problem was that MySqlCommand.CommandTimeout has a hidden function.  If the underlying value is 0 then the default value is returned, otherwise the underlying value is returned.  In our Clone method we were using CommandTimeout which would return the default value rather than the underlying value.  This would, in effect, disable our default command timeout which relied on the underlying value still being 0.

    modified:
      CHANGES
      MySql.Data.Entity/Tests/ProceduresAndFunctions.cs
      MySql.Data.Entity/Tests/Properties/procs.sql
      MySql.Data/Provider/Source/command.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-10-06 20:34:20 +0000
+++ b/CHANGES	2010-10-07 21:10:46 +0000
@@ -1,4 +1,6 @@
 - fixed problem with using bit parameters as output (bug #56756)
+- fixed MySqlCommand.Clone so that the default command timeoout functionality is not disabled when
+  you clone a command (bug #56806)
 
 Version 6.0.7
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data.Entity/Tests/ProceduresAndFunctions.cs'
--- a/MySql.Data.Entity/Tests/ProceduresAndFunctions.cs	2010-01-06 20:56:55 +0000
+++ b/MySql.Data.Entity/Tests/ProceduresAndFunctions.cs	2010-10-07 21:10:46 +0000
@@ -122,6 +122,36 @@
                     Assert.AreEqual(6, reader[0]);
                 }
             }
-        }        
+        }
+
+        /// <summary>
+        /// Bug #56806	Default Command Timeout has no effect in connection string
+        /// </summary>
+        [Test]
+        public void CommandTimeout()
+        {
+            string connectionString = String.Format(
+                "metadata=res://*/TestModel.csdl|res://*/TestModel.ssdl|res://*/TestModel.msl;provider=MySql.Data.MySqlClient; provider connection string=\"{0};default command timeout=5\"", GetConnectionString(true));
+            EntityConnection connection = new EntityConnection(connectionString);
+
+            using (testEntities context = new testEntities(connection))
+            {
+                Author a = new Author();
+                a.Id = 66;  // special value to indicate the routine should take 30 seconds
+                a.Name = "Test name";
+                a.Age = 44;
+                context.AddToAuthors(a);
+                try
+                {
+                    context.SaveChanges();
+                    Assert.Fail("This should have timed out");
+                }
+                catch (Exception ex)
+                {
+                    string s = ex.Message;
+                }
+            }
+        }
+
     }
 }
\ No newline at end of file

=== modified file 'MySql.Data.Entity/Tests/Properties/procs.sql'
--- a/MySql.Data.Entity/Tests/Properties/procs.sql	2010-01-05 22:09:58 +0000
+++ b/MySql.Data.Entity/Tests/Properties/procs.sql	2010-10-07 21:10:46 +0000
@@ -5,7 +5,11 @@
 
 CREATE PROCEDURE AddAuthor(theid INT, thename VARCHAR(20), theage INT) 
 BEGIN
-	INSERT INTO authors VALUES (theid, thename, theage);
+	IF theid = 66 THEN
+		SELECT SLEEP(30);
+	ELSE
+		INSERT INTO authors VALUES (theid, thename, theage);
+	END IF;
 END $$
 
 CREATE PROCEDURE DeleteAuthor(theid int)

=== modified file 'MySql.Data/Provider/Source/command.cs'
--- a/MySql.Data/Provider/Source/command.cs	2010-06-17 00:19:33 +0000
+++ b/MySql.Data/Provider/Source/command.cs	2010-10-07 21:10:46 +0000
@@ -746,7 +746,7 @@
 		{
 			MySqlCommand clone = new MySqlCommand(cmdText, connection, curTransaction);
             clone.CommandType = CommandType;
-            clone.CommandTimeout = CommandTimeout;
+            clone.commandTimeout = commandTimeout;
             clone.batchableCommandText = batchableCommandText;
             clone.UpdatedRowSource = UpdatedRowSource;
 


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20101007211046-vti8j5xepz1ygfgi.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:840) Bug#56806Reggie Burnett7 Oct