* SqlConnection.cs(ChangeState): Return immediately when new state
authorGert Driesen <drieseng@users.sourceforge.net>
Mon, 28 Jul 2008 13:53:56 +0000 (13:53 -0000)
committerGert Driesen <drieseng@users.sourceforge.net>
Mon, 28 Jul 2008 13:53:56 +0000 (13:53 -0000)
equals original state. Fixes bug #412574. Removed extra whitespace.
* SqlConnectionTest.cs: Enabled test for bug #412574.

svn path=/trunk/mcs/; revision=109009

mcs/class/System.Data/System.Data.SqlClient/ChangeLog
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/ChangeLog
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs

index 0dd57d474836d3f4cdd8502266f502cef7c8f6be..3ae30a67885823844f5524cf9752a3a2fd186243 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-28  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * SqlConnection.cs(ChangeState): Return immediately when new state
+       equals original state. Fixes bug #412574.
+
 2008-07-23  Veerapuram Varadhan  <vvaradhan@novell.com>
 
        * SqlDataReader.cs (NextResult): Memleak fix - mark datatypeNames
index b45268debd5c7ee62c27f241a7366809f65be1c7..b2ef5710ce3de98ec3b3c172028eba5c429d6c4a 100644 (file)
@@ -393,7 +393,7 @@ namespace System.Data.SqlClient
 #if NET_2_0
                override
 #endif // NET_2_0
-               void ChangeDatabase (string database) 
+               void ChangeDatabase (string database)
                {
                        if (!IsValidDatabaseName (database))
                                throw new ArgumentException (String.Format ("The database name {0} is not valid.", database));
@@ -404,6 +404,9 @@ namespace System.Data.SqlClient
 
                private void ChangeState (ConnectionState currentState)
                {
+                       if (currentState == state)
+                               return;
+
                        ConnectionState originalState = state;
                        state = currentState;
                        OnStateChange (CreateStateChangeEvent (originalState, currentState));
@@ -413,7 +416,7 @@ namespace System.Data.SqlClient
 #if NET_2_0
                override
 #endif // NET_2_0
-               void Close () 
+               void Close ()
                {
                        if (transaction != null && transaction.IsOpen)
                                transaction.Rollback ();
@@ -443,7 +446,7 @@ namespace System.Data.SqlClient
                        ChangeState (ConnectionState.Closed);
                }
 
-               public new SqlCommand CreateCommand () 
+               public new SqlCommand CreateCommand ()
                {
                        SqlCommand command = new SqlCommand ();
                        command.Connection = this;
@@ -565,7 +568,7 @@ namespace System.Data.SqlClient
                        ChangeState (ConnectionState.Open);
                }
 
-               private bool ParseDataSource (string theDataSource, out int thePort, out string theServerName) 
+               private bool ParseDataSource (string theDataSource, out int thePort, out string theServerName)
                {
                        theServerName = string.Empty;
                        string theInstanceName = string.Empty;
@@ -905,7 +908,7 @@ namespace System.Data.SqlClient
                }
 #endif
 
-               private sealed class SqlMonitorSocket : UdpClient 
+               private sealed class SqlMonitorSocket : UdpClient
                {
                        // UDP port that the SQL Monitor listens
                        private static readonly int SqlMonitorUdpPort = 1434;
@@ -921,7 +924,7 @@ namespace System.Data.SqlClient
                                instance = InstanceName;
                        }
 
-                       internal int DiscoverTcpPort (int timeoutSeconds) 
+                       internal int DiscoverTcpPort (int timeoutSeconds)
                        {
                                int SqlServerTcpPort;
                                Client.Blocking = false;
@@ -976,9 +979,11 @@ namespace System.Data.SqlClient
                }
 
 #if NET_2_0
-               struct ColumnInfo {
+               struct ColumnInfo
+               {
                        public string name;
                        public Type type;
+
                        public ColumnInfo (string name, Type type)
                        {
                                this.name = name; this.type = type;
index 3b2a72d949550c176b4e8cb7acb1d818941df293..fae87d28da3cd2042ffdd276eb1db774d59b6f9c 100644 (file)
@@ -1,3 +1,7 @@
+2008-07-28  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * SqlConnectionTest.cs: Enabled test for bug #412574.
+
 2008-07-28  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * SqlCommandTest.cs: Moved tests that do not require connection to
index 14d2bf4fceef5ab449a778962ca75d898113bf7f..19c9f915696b00dc88b84637923562c1d01e1ed4 100644 (file)
@@ -208,8 +208,6 @@ namespace MonoTests.System.Data
                [Test] // bug #412574
                public void Close ()
                {
-                       Assert.Ignore ("bug #412574");
-
                        conn = new SqlConnection (connectionString);
                        conn.Open ();
                        conn.StateChange += new StateChangeEventHandler (Connection_StateChange);