List:Commits« Previous MessageNext Message »
From:rburnett Date:April 4 2008 5:07pm
Subject:Connector/NET commit: r1212 - in branches/5.2: . Driver Driver/Properties Driver/Source TestSuite/Source VisualStudio
View as plain text  
Modified:
   branches/5.2/CHANGES
   branches/5.2/Driver/MySql.Data.CF.csproj
   branches/5.2/Driver/Properties/Resources.resx
   branches/5.2/Driver/Source/CommandBuilder.cs
   branches/5.2/Driver/Source/SchemaProvider.cs
   branches/5.2/Driver/Source/datareader.cs
   branches/5.2/TestSuite/Source/CommandBuilderTests.cs
   branches/5.2/TestSuite/Source/StressTests.cs
   branches/5.2/VisualStudio/ServerExplorerFacade.cs
Log:
merged

Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/CHANGES	2008-04-04 17:07:42 UTC (rev 1212)
@@ -31,6 +31,7 @@
   It actually works now.  (bug #34792)
 
 Version 5.2 - 2/11/2008
+>>>>>>> .r1182
 . Added ClearPool and ClearAllPools features
 . DDEX provider now works under Visual Studio 2008	
 . Added support for DbDataAdapter UpdateBatchSize.  Batching is fully supported
@@ -44,6 +45,9 @@
 . Added Allow User Variables connection string option so that users can use user variables
   without getting missing parameter exceptions
   
+<<<<<<< .mine
+Version 5.1.5 - 2/11/2008
+=======
 Version 5.1.6 
  - Fixed problem where parameters lists were not showing when you tried to alter a routine 
    in server explorer.  (bug #34359)
@@ -51,8 +55,14 @@
    and cause a memory leak (bug #34338)
  - Fixed problem where attempting to use an isolation level other than the default with
    a transaction scope would use the default instead (bug #34448)
-   
+ - Fixed problem that causes the TableAdapter wizard to only generate insert statements.
+   The problem was that our code to retrieve index columns was broken. (bug #31338)
+ - Fixed problem with connections staying open after being used with SqlDataSource.
+   The problem was that we were not returning an enumerator for our reader with the
+   closeReader option set to true when we were supposed to.  (Bug #34460)
+      
 Version 5.1.5 - 2/11/2008
+>>>>>>> .r1182
   - Fixed problem with membership provider where FindUserByEmail would fail trying to add
     a second parameter with the same name as the first (bug #33347)
   - Fixed long standing problem with compression over a network.  It's now fast again. (bug #27865)    
@@ -179,9 +189,12 @@
     DbProviderFactory users can access the server error code (Bug #27436) 
   - fixed problem where changing the connection string of a connection to one that changes
     the parameter marker after the connection had been assigned to a command but before
-    the connection is opened can cause parameters to not be found (bug #13991) 
-                            
-Version 5.0.8  8/16/2007
+    the connection is opened can cause parameters to not be found (bug #13991)          
+  - added implementation of MySqlCommandBuilder methods QuoteIdentifier and UnquoteIdentifier
+    (bug #35492)        
+        
+Version 5.0.8   8/16/2007
+
   Bug #28706 Log messages are truncated  
   - Fixed a problem with compression over a network.  We were letting the inflate stream read
     directly from the network stream.  Under certain situations, two bytes were being left unread

Modified: branches/5.2/Driver/MySql.Data.CF.csproj
===================================================================
--- branches/5.2/Driver/MySql.Data.CF.csproj	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/Driver/MySql.Data.CF.csproj	2008-04-04 17:07:42 UTC (rev 1212)
@@ -67,10 +67,8 @@
     <Compile Include="Source\cf\WinCE.cs" />
     <Compile Include="Source\CharSetMap.cs" />
     <Compile Include="Source\command.cs">
-      <SubType>Component</SubType>
     </Compile>
     <Compile Include="Source\CommandBuilder.cs">
-      <SubType>Component</SubType>
     </Compile>
     <Compile Include="Source\common\Cache.cs" />
     <Compile Include="Source\common\ContextString.cs" />
@@ -87,7 +85,6 @@
     </Compile>
     <Compile Include="Source\Crypt.cs" />
     <Compile Include="Source\dataadapter.cs">
-      <SubType>Component</SubType>
     </Compile>
     <Compile Include="Source\datareader.cs" />
     <Compile Include="Source\Driver.cs" />

Modified: branches/5.2/Driver/Properties/Resources.resx
===================================================================
--- branches/5.2/Driver/Properties/Resources.resx	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/Driver/Properties/Resources.resx	2008-04-04 17:07:42 UTC (rev 1212)
@@ -301,7 +301,7 @@
     <value>Unable to connect to any of the specified MySQL hosts.</value>
   </data>
   <data name="UnableToRetrieveSProcData" xml:space="preserve">
-    <value>Unable to retrieve stored procedure metadata.  Either grant  SELECTprivilege to mysql.proc for this user or use "use procedure bodies=false" with  your connection string.</value>
+    <value>Unable to retrieve stored procedure metadata.  Either grant  SELECT privilege to mysql.proc for this user or use "use procedure bodies=false" with  your connection string.</value>
   </data>
   <data name="NextResultIsClosed" xml:space="preserve">
     <value>Invalid attempt to call NextResult when the reader is closed.</value>

Modified: branches/5.2/Driver/Source/CommandBuilder.cs
===================================================================
--- branches/5.2/Driver/Source/CommandBuilder.cs	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/Driver/Source/CommandBuilder.cs	2008-04-04 17:07:42 UTC (rev 1212)
@@ -175,6 +175,42 @@
             base.RefreshSchema();
             finalSelect = null;
         }
+
+        public override string QuoteIdentifier(string unquotedIdentifier)
+        {
+            if (unquotedIdentifier == null) throw new
+                ArgumentNullException("unquotedIdentifier");
+
+            // don't quote again if it is already quoted
+            if (unquotedIdentifier.StartsWith(QuotePrefix) &&
+                unquotedIdentifier.EndsWith(QuoteSuffix))
+                return unquotedIdentifier;
+
+            unquotedIdentifier = unquotedIdentifier.Replace(QuotePrefix, QuotePrefix + QuotePrefix);
+
+            return String.Format("{0}{1}{2}", QuotePrefix, unquotedIdentifier, QuoteSuffix);
+        }
+
+        public override string UnquoteIdentifier(string quotedIdentifier)
+        {
+            if (quotedIdentifier == null) throw new
+                ArgumentNullException("quotedIdentifier");
+
+            // don't unquote again if it is already unquoted
+            if (!quotedIdentifier.StartsWith(QuotePrefix) ||
+                !quotedIdentifier.EndsWith(QuoteSuffix))
+                return quotedIdentifier;
+
+            if (quotedIdentifier.StartsWith(QuotePrefix))
+                quotedIdentifier = quotedIdentifier.Substring(1);
+            if (quotedIdentifier.EndsWith(QuoteSuffix))
+                quotedIdentifier = quotedIdentifier.Substring(0, quotedIdentifier.Length - 1);
+
+            quotedIdentifier = quotedIdentifier.Replace(QuotePrefix + QuotePrefix, QuotePrefix);
+
+            return quotedIdentifier;
+        }
+
         #endregion
 
 

Modified: branches/5.2/Driver/Source/SchemaProvider.cs
===================================================================
--- branches/5.2/Driver/Source/SchemaProvider.cs	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/Driver/Source/SchemaProvider.cs	2008-04-04 17:07:42 UTC (rev 1212)
@@ -295,7 +295,11 @@
             dt.Columns.Add("COLUMN_NAME", typeof (string));
             dt.Columns.Add("ORDINAL_POSITION", typeof (int));
 
-            DataTable tables = GetTables(restrictions);
+            string[] tableRestrictions = new string[restrictions.Length];
+            restrictions.CopyTo(tableRestrictions, 0);
+            tableRestrictions[3] = "BASE TABLE";
+            DataTable tables = GetTables(tableRestrictions);
+
             foreach (DataRow table in tables.Rows)
             {
                 string sql = String.Format("SHOW INDEX FROM `{0}`.`{1}`",

Modified: branches/5.2/Driver/Source/datareader.cs
===================================================================
--- branches/5.2/Driver/Source/datareader.cs	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/Driver/Source/datareader.cs	2008-04-04 17:07:42 UTC (rev 1212)
@@ -959,8 +959,8 @@
 		/// <returns></returns>
 		public override IEnumerator GetEnumerator()
 		{
-			return new DbEnumerator(this);
-		}
+            return new DbEnumerator(this, (commandBehavior & CommandBehavior.CloseConnection) != 0);
+        }
 
 		#endregion
 	}

Modified: branches/5.2/TestSuite/Source/CommandBuilderTests.cs
===================================================================
--- branches/5.2/TestSuite/Source/CommandBuilderTests.cs	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/TestSuite/Source/CommandBuilderTests.cs	2008-04-04 17:07:42 UTC (rev 1212)
@@ -369,6 +369,7 @@
                 da.Update(changes);
                 dt.AcceptChanges();
 
+<<<<<<< .working
                 dt.Rows[0]["id"] = 7;
                 dt.Rows[0]["name"] = "test7";
                 dt.Rows[1]["id"] = 8;
@@ -421,4 +422,34 @@
             }
         }
     }
+=======
+				dt.Clear();
+				da.SelectCommand.CommandText = "SELECT * FROM test WHERE cod=6";
+				da.Fill(dt);
+				Assert.AreEqual(6, dt.Rows[0]["cod"]);
+			}
+			catch (Exception ex)
+			{
+				Assert.Fail(ex.Message);
+			}
+		}
+
+        /// <summary>
+        /// Bug #35492 Please implement DbCommandBuilder.QuoteIdentifier 
+        /// </summary>
+        [Test]
+        public void QuoteAndUnquoteIdentifiers()
+        {
+            MySqlCommandBuilder cb = new MySqlCommandBuilder();
+            Assert.AreEqual("`boo`", cb.QuoteIdentifier("boo"));
+            Assert.AreEqual("`bo``o`", cb.QuoteIdentifier("bo`o"));
+            Assert.AreEqual("`boo`", cb.QuoteIdentifier("`boo`"));
+
+            // now do the unquoting
+            Assert.AreEqual("boo", cb.UnquoteIdentifier("`boo`"));
+            Assert.AreEqual("`boo", cb.UnquoteIdentifier("`boo"));
+            Assert.AreEqual("bo`o", cb.UnquoteIdentifier("`bo``o`"));
+        }
+	}
+>>>>>>> .merge-right.r1210
 }

Modified: branches/5.2/TestSuite/Source/StressTests.cs
===================================================================
--- branches/5.2/TestSuite/Source/StressTests.cs	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/TestSuite/Source/StressTests.cs	2008-04-04 17:07:42 UTC (rev 1212)
@@ -48,55 +48,61 @@
 		{
 			int len = 20000000;
 
-			// currently do not test this with compression
-			if (conn.UseCompression) return;
+            // currently do not test this with compression
+            if (conn.UseCompression) return;
 
-			byte[] dataIn = Utils.CreateBlob(len);
-			byte[] dataIn2 = Utils.CreateBlob(len);
+            using (MySqlConnection c = new MySqlConnection(GetConnectionString(true)))
+            {
+                suExecSQL("SET GLOBAL max_allowed_packet=64000000");
+                c.Open();
+                suExecSQL("SET GLOBAL max_allowed_packet=" + 1500000);
+                byte[] dataIn = Utils.CreateBlob(len);
+                byte[] dataIn2 = Utils.CreateBlob(len);
 
-            MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (?id, NULL, ?blob, NULL )", conn);
-		    cmd.CommandTimeout = 0;
-			cmd.Parameters.Add(new MySqlParameter("?id", 1));
-			cmd.Parameters.Add(new MySqlParameter("?blob", dataIn));
-			try 
-			{
-				cmd.ExecuteNonQuery();
-			}
-			catch (Exception ex) 
-			{
-				Assert.Fail(ex.Message);
-			}
+                MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (?id, NULL, ?blob, NULL )", c);
+                cmd.CommandTimeout = 0;
+                cmd.Parameters.Add(new MySqlParameter("?id", 1));
+                cmd.Parameters.Add(new MySqlParameter("?blob", dataIn));
+                try
+                {
+                    cmd.ExecuteNonQuery();
+                }
+                catch (Exception ex)
+                {
+                    Assert.Fail(ex.Message);
+                }
 
-			cmd.Parameters[0].Value = 2;
-			cmd.Parameters[1].Value = dataIn2;
-			cmd.ExecuteNonQuery();
+                cmd.Parameters[0].Value = 2;
+                cmd.Parameters[1].Value = dataIn2;
+                cmd.ExecuteNonQuery();
 
-			cmd.CommandText = "SELECT * FROM Test";
+                cmd.CommandText = "SELECT * FROM Test";
 
-            try
-            {
-                using (MySqlDataReader reader = cmd.ExecuteReader())
+                try
                 {
-                    reader.Read();
-                    byte[] dataOut = new byte[len];
-                    long count = reader.GetBytes(2, 0, dataOut, 0, len);
-                    Assert.AreEqual(len, count);
+                    using (MySqlDataReader reader = cmd.ExecuteReader())
+                    {
+                        reader.Read();
+                        byte[] dataOut = new byte[len];
+                        long count = reader.GetBytes(2, 0, dataOut, 0, len);
+                        Assert.AreEqual(len, count);
 
-                    for (int i = 0; i < len; i++)
-                        Assert.AreEqual(dataIn[i], dataOut[i]);
+                        for (int i = 0; i < len; i++)
+                            Assert.AreEqual(dataIn[i], dataOut[i]);
 
-                    reader.Read();
-                    count = reader.GetBytes(2, 0, dataOut, 0, len);
-                    Assert.AreEqual(len, count);
+                        reader.Read();
+                        count = reader.GetBytes(2, 0, dataOut, 0, len);
+                        Assert.AreEqual(len, count);
 
-                    for (int i = 0; i < len; i++)
-                        Assert.AreEqual(dataIn2[i], dataOut[i]);
+                        for (int i = 0; i < len; i++)
+                            Assert.AreEqual(dataIn2[i], dataOut[i]);
+                    }
                 }
+                catch (Exception ex)
+                {
+                    Assert.Fail(ex.Message);
+                }
             }
-            catch (Exception ex)
-            {
-                Assert.Fail(ex.Message);
-            }
 		}
 
 #endif

Modified: branches/5.2/VisualStudio/ServerExplorerFacade.cs
===================================================================
--- branches/5.2/VisualStudio/ServerExplorerFacade.cs	2008-04-04 17:02:31 UTC (rev 1211)
+++ branches/5.2/VisualStudio/ServerExplorerFacade.cs	2008-04-04 17:07:42 UTC (rev 1212)
@@ -190,17 +190,35 @@
         }
 
         /// <summary>
-        /// Returns array with posible children object type names for the hierarchy item.
+        /// Returns array with possible children object type names for the hierarchy item.
         /// </summary>
         /// <param name="item">The hierarchy item identifier to process.</param>
         /// <returns>Returns array with posible children object type names for the hierarchy item.</returns>
+        /// 
+        /// This routine is a complete hack since GetChildSelectionTypes
+        /// appears to crash under VS2008.  we are rewriting the DDEX provider
+        /// for 5.3 so this code will disappear.
         public string[] GetChildTypes(int item)
         {
             if (item < 0)
                 throw new ArgumentException(Resources.Error_InvalidHierarchyItemID, "item");
             Debug.Assert(hierarchyAccessor != null, "Hierarchy accessor is not initialized!");
 
-            return hierarchyAccessor.GetChildSelectionTypes(item);
+            //string[] typeNames = new string[1];
+            int parent = (int)hierarchyAccessor.GetProperty(item, (int)__VSHPROPID.VSHPROPID_Parent);
+            if (parent == VSConstants.VSITEMID_ROOT || parent < 0)
+            {
+                string name = hierarchyAccessor.GetNodeName(item);
+                if (name == "Stored Procedures" || name == "Functions")
+                    return new string[] { "StoredProcedure" };
+                else if (name.EndsWith("s"))
+                    return new string[] { name.Substring(0, name.Length - 1) };
+            }
+
+            string nodeId = hierarchyAccessor.GetNodeId(item);
+            if (nodeId == "Table")
+                return new string[] { "Trigger" };
+            return null;
         }
 
         /// <summary>

Thread
Connector/NET commit: r1212 - in branches/5.2: . Driver Driver/Properties Driver/Source TestSuite/Source VisualStudiorburnett4 Apr