List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:June 22 2011 3:56pm
Subject:bzr commit into connector-net-6.3 branch (reggie.burnett:1017)
View as plain text  
#At file:///C:/Users/Reggie/work/connector-net/6.3/ based on revid:reggie.burnett@stripped

 1017 Reggie Burnett	2011-06-22
      fixed object enumeration when going against a 5.5 server

    modified:
      Source/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs
      Source/MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml
=== modified file 'Source/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs'
=== modified file 'Source/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs'
--- a/Source/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs	2011-02-14 17:19:36 +0000
+++ b/Source/MySql.VisualStudio/DDEX/MySqlDataObjectEnumerator.cs	2011-06-22 15:56:36 +0000
@@ -75,20 +75,60 @@
             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);
+            if (typeName == String.Empty)
+                return EnumerateRoot();
+            else return EnumerateSchemaObjects(parameters[0] as string, restrictions);
+        }
+
+        private DataReader EnumerateRoot()
+        {
+            DbConnection conn = (DbConnection)Connection.GetLockedProviderObject();
+            try
+            {
+                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);
+                return new AdoDotNetDataTableReader(table);
+            }
+            finally
+            {
+                Connection.UnlockProviderObject();
+            }
+        }
+
+        private DataReader EnumerateSchemaObjects(string typeName, object[] restrictions)
+        {
+            DbConnection conn = (DbConnection)Connection.GetLockedProviderObject();
+            try
+            {
+                string[] rest;
+                DataTable tables = null;
+
+                if (restrictions != null)
+                {
+                    int i = 0;
+                    rest = new string[restrictions.Length];
+                    foreach (object o in restrictions)
+                        rest[i++] = (string)o;
+                    tables = conn.GetSchema(typeName, rest);
+                }
+                else
+                    tables = conn.GetSchema(typeName);
+
+                foreach (DataRow row in tables.Rows)
+                    row["TABLE_CATALOG"] = DBNull.Value;
+                return new AdoDotNetDataTableReader(tables);
+            }
+            finally
+            {
+                Connection.UnlockProviderObject();
+            }
+        }
 
 /*
             // Chose restricitions array
@@ -132,7 +172,6 @@
 
             // Enumerete objects in to DataReader
             return new AdoDotNetDataTableReader(table);*/
-        }
 
         #region Connection wrapper
         /// <summary>

=== modified file 'Source/MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml'
--- a/Source/MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml	2011-02-14 17:19:36 +0000
+++ b/Source/MySql.VisualStudio/DDEX/MySqlDataObjectSupport.xml	2011-06-22 15:56:36 +0000
@@ -84,10 +84,9 @@
         <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">
-          <Parameter value="Tables"/>
-        </Action>
+          <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"
                 handler="Microsoft.VisualStudio.Data.DSRefBuilder">
           <Parameter>
@@ -166,7 +165,7 @@
         <Property name="SecurityType" type="System.String" itemName="SECURITY_TYPE" />
       </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="Views"/>
         </Action>
         <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
@@ -300,7 +299,7 @@
         <Property name="Comment" type="System.String" itemName="COLUMN_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="Columns"/>
         </Action>
         <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="MySql.Data.VisualStudio.MyDSRefBuilder">


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110622155636-rf1jcyy3cc4wh15u.bundle
Thread
bzr commit into connector-net-6.3 branch (reggie.burnett:1017) Reggie Burnett23 Jun