List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:January 6 2011 4:00pm
Subject:bzr commit into connector-net-6.0 branch (reggie.burnett:857)
View as plain text  
#At file:///C:/Users/Reggie/work/connector-net/6.0/ based on revid:reggie.burnett@stripped

  857 Reggie Burnett	2011-01-06
      - small code adjustment to make sure our object enumeration works with MySQL 5.5

    modified:
      CHANGES
      MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs
      MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-12-14 22:56:36 +0000
+++ b/CHANGES	2011-01-06 16:00:10 +0000
@@ -19,6 +19,7 @@
   It seems to not be necessary (bug #58853)
 - fixed unnecessary string code in MySqlTokenizer (bug #58757)
 - fixed MembershipProvider to properly set a hash key when using a keyed hash alogrithm (bug #58906)
+- small code adjustment to make sure our object enumeration works with MySQL 5.5
 
 Version 6.0.7
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs'
--- a/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs	2009-04-21 18:02:13 +0000
+++ b/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs	2011-01-06 16:00:10 +0000
@@ -26,12 +26,12 @@
 
 namespace MySql.Data.VisualStudio
 {
-	/// <summary>
+    /// <summary>
     /// Implements custom database objects enumerator for MySQL databases. 
     /// Uses information_schema database to enumerate objects.
-	/// </summary>
-	public class MySqlDataObjectEnumerator : AdoDotNetObjectEnumerator
-	{
+    /// </summary>
+    public class MySqlDataObjectEnumerator : AdoDotNetObjectEnumerator
+    {
         /// <summary>
         /// Enumerates items for a set of data objects of the specified type 
         /// with the specified restrictions and sort string, if supported. 
@@ -69,83 +69,45 @@
             if (typeName == null)
                 throw new ArgumentNullException("typeName");
 
-			Debug.Assert(typeName == String.Empty);
-
-			DbConnection conn = (DbConnection)Connection.GetLockedProviderObject();
-			DataTable table = new DataTable();
-			table.Columns.Add("SERVER_NAME");
-			table.Columns.Add("CATALOG_NAME");
-			table.Columns.Add("SCHEMA_NAME");
-			DataRow row = table.NewRow();
-			row["SERVER_NAME"] = conn.DataSource;
-			row["SCHEMA_NAME"] = conn.Database;
-			table.Rows.Add(row);
-			Connection.UnlockProviderObject();
-
-			return new AdoDotNetDataTableReader(table);
-
-/*
-            // Chose restricitions array
-            object[] appliedRestrictions;
-            if (typeName.Equals(RootDescriptor.TypeName, StringComparison.InvariantCultureIgnoreCase))
-            {
-
-                appliedRestrictions = new object[] { 
-                                        ConnectionWrapper.ServerName, 
-                                        ConnectionWrapper.Schema 
-                                        };
-            }
-            else
-            {
-                appliedRestrictions = restrictions;
-            }
-
-            DataTable table;
+            if (typeName == String.Empty)
+                return RootEnumeration();
+
+            Debug.Assert(typeName == "Table");
+            DbConnection conn = (DbConnection)Connection.GetLockedProviderObject();
             try
             {
-                // Enumerate objects into table
-                table = ObjectDescriptor.EnumerateObjects(ConnectionWrapper, typeName, appliedRestrictions, sort);
-            }
-            catch (DbException e)
-            {
-                SqlErrorDialog.ShowError(e, ConnectionWrapper.GetFullStatus());
-                throw;
-            }
-            catch (Exception e)
-            {
-                UIHelper.ShowError(e);
-                throw;
-            }
-
-            // Validate table
-            if (table == null)
-            {
-                Debug.Fail("Failed to enumerate objects of type '" + typeName + "'!");
-                return null;
-            }
-
-            // Enumerete objects in to DataReader
-            return new AdoDotNetDataTableReader(table);*/
+                string[] rest = null;
+                if (restrictions != null)
+                {
+                    rest = new string[restrictions.Length];
+                    restrictions.CopyTo(rest, 0);
+                }
+                DataTable tables = conn.GetSchema((string)parameters[0], rest);
+                if (tables != null)
+                    foreach (DataRow row in tables.Rows)
+                        row["TABLE_CATALOG"] = DBNull.Value;
+                return new AdoDotNetDataTableReader(tables);
+            }
+            finally
+            {
+                Connection.UnlockProviderObject();
+            }
         }
 
-        #region Connection wrapper
-        /// <summary>
-        /// Returns wrapper for the underlying connection. Creates it at the first call.
-        /// </summary>
-/*        private DataConnectionWrapper ConnectionWrapper
+        private DataReader RootEnumeration()
         {
-            get
-            {
-                if (connectionWrapperRef == null)                
-                    connectionWrapperRef = new DataConnectionWrapper(Connection);
-                return connectionWrapperRef;
-            }
+            DbConnection conn = (DbConnection)Connection.GetLockedProviderObject();
+            DataTable table = new DataTable();
+            table.Columns.Add("SERVER_NAME");
+            table.Columns.Add("CATALOG_NAME");
+            table.Columns.Add("SCHEMA_NAME");
+            DataRow row = table.NewRow();
+            row["SERVER_NAME"] = conn.DataSource;
+            row["SCHEMA_NAME"] = conn.Database;
+            table.Rows.Add(row);
+            Connection.UnlockProviderObject();
+
+            return new AdoDotNetDataTableReader(table);
         }
-        /// <summary>
-        /// Used to stroe connection wrapper.
-        /// </summary>
-        private DataConnectionWrapper connectionWrapperRef;*/
-        #endregion
-
-	}
+    }
 }

=== modified file 'MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml'
--- a/MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml	2008-09-04 16:52:41 +0000
+++ b/MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml	2011-01-06 16:00:10 +0000
@@ -84,8 +84,8 @@
         <Property name="Comment" type="System.String" itemName="TABLE_COMMENT"/>
       </Properties>
       <Actions>
-        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A"
-                handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
+          <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" 
+                  handler="MySql.Data.VisualStudio.MySqlDataObjectEnumerator">
           <Parameter value="Tables"/>
         </Action>
         <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144"


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110106160010-hpmrr0mal907wklq.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:857) Reggie Burnett6 Jan