List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:July 2 2010 6:36pm
Subject:bzr commit into connector-net-6.0 branch (reggie.burnett:822) Bug#33870
View as plain text  
#At file:///C:/work/connector-net/6.0/ based on revid:vvaintroub@stripped

  822 Reggie Burnett	2010-07-02
      - changed DbCommandBuilder and added a MySqlDataObjectIdentifierConverter so we don't output
        the databasename in our typed datasets.  This allows users to move the dataset to a new
        database/server with no trouble (bug #33870)

    added:
      MySql.VisualStudio/DDEX/MySqlDataObjectIdentifierConverter.cs
    modified:
      CHANGES
      MySQLClient.sln
      MySql.Data/Provider/Source/CommandBuilder.cs
      MySql.VisualStudio/DDEX/MySqlConnectionSupport.cs
      MySql.VisualStudio/MySql.VisualStudio.csproj
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-07-01 16:04:18 +0000
+++ b/CHANGES	2010-07-02 18:36:52 +0000
@@ -10,6 +10,9 @@
 - added public MySqlHelper.ExecuteDataReader method that takes an external connection (bug #54570)
 - applied patch from 5.x series that reset the connection to the base encoding when doing a 
   connection reset (bug #47153)
+- changed DbCommandBuilder and added a MySqlDataObjectIdentifierConverter so we don't output
+  the databasename in our typed datasets.  This allows users to move the dataset to a new
+  database/server with no trouble (bug #33870)
 
 Version 6.0.6
 - When sending file to server (LOAD DATA INFILE) open the file for read only, not for read/write

=== modified file 'MySQLClient.sln'
--- a/MySQLClient.sln	2010-01-14 22:26:14 +0000
+++ b/MySQLClient.sln	2010-07-02 18:36:52 +0000
@@ -231,7 +231,6 @@
 		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Commercial|x64.ActiveCfg = Release|Any CPU
 		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Commercial|x86.ActiveCfg = Release|Any CPU
 		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
 		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
 		{A8E799B1-D6AC-42BD-907E-B213D7E9B3C5}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -255,7 +254,6 @@
 		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Commercial|x64.ActiveCfg = Release|Any CPU
 		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Commercial|x86.ActiveCfg = Release|Any CPU
 		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
 		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
 		{77EC4E20-293A-48BA-8415-D0AD869D91FA}.Debug|x64.ActiveCfg = Debug|Any CPU

=== modified file 'MySql.Data/Provider/Source/CommandBuilder.cs'
--- a/MySql.Data/Provider/Source/CommandBuilder.cs	2010-04-22 15:29:22 +0000
+++ b/MySql.Data/Provider/Source/CommandBuilder.cs	2010-07-02 18:36:52 +0000
@@ -220,6 +220,16 @@
 
         #endregion
 
+        protected override DataTable GetSchemaTable(DbCommand sourceCommand)
+        {
+            DataTable schemaTable = base.GetSchemaTable(sourceCommand);
+
+            foreach (DataRow row in schemaTable.Rows)
+                if (row["BaseSchemaName"].Equals(sourceCommand.Connection.Database))
+                    row["BaseSchemaName"] = null;
+
+            return schemaTable;
+        }
 
         /// <summary>
         /// 

=== modified file 'MySql.VisualStudio/DDEX/MySqlConnectionSupport.cs'
--- a/MySql.VisualStudio/DDEX/MySqlConnectionSupport.cs	2010-02-12 18:11:12 +0000
+++ b/MySql.VisualStudio/DDEX/MySqlConnectionSupport.cs	2010-07-02 18:36:52 +0000
@@ -67,7 +67,10 @@
             {
                 return new MySqlDataSourceInformation(Site as DataConnection);
             }
-			else return base.GetServiceImpl(serviceType);
+            else if (serviceType == typeof(DataObjectIdentifierConverter))
+                return new MySqlDataObjectIdentifierConverter(Site as DataConnection);
+            else 
+                return base.GetServiceImpl(serviceType);
         }
 
         public override bool Open(bool doPromptCheck)

=== added file 'MySql.VisualStudio/DDEX/MySqlDataObjectIdentifierConverter.cs'
--- a/MySql.VisualStudio/DDEX/MySqlDataObjectIdentifierConverter.cs	1970-01-01 00:00:00 +0000
+++ b/MySql.VisualStudio/DDEX/MySqlDataObjectIdentifierConverter.cs	2010-07-02 18:36:52 +0000
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.VisualStudio.Data.AdoDotNet;
+using Microsoft.VisualStudio.Data;
+using System.Data.Common;
+
+namespace MySql.Data.VisualStudio
+{
+    public class MySqlDataObjectIdentifierConverter : AdoDotNetObjectIdentifierConverter
+    {
+        private DataConnection connection;
+
+        public MySqlDataObjectIdentifierConverter(DataConnection c)
+            : base(c)
+        {
+            connection = c;
+        }
+
+        protected override string BuildString(string typeName, string[] identifierParts, bool forDisplay)
+        {
+            string id = String.Empty;
+
+            if (typeName == "Table")
+            {
+                DbConnection c = connection.ConnectionSupport.ProviderObject as DbConnection;
+
+                if (identifierParts.Length == 1) 
+                    id = identifierParts[0];
+                if (identifierParts.Length == 2 && identifierParts[0] == c.Database)
+                    id = identifierParts[1];
+                if (identifierParts.Length == 3 && identifierParts[1] == c.Database)
+                    id = identifierParts[2];
+            }
+            if (id == String.Empty || forDisplay)
+                id = base.BuildString(typeName, identifierParts, forDisplay);
+            return id;
+        }
+
+        protected override string FormatPart(string typeName, object identifierPart, bool withQuotes)
+        {
+            DbConnection c = connection.ConnectionSupport.ProviderObject as DbConnection;
+            if (typeName == "Table" && identifierPart.Equals(c.Database))
+                return null;
+            return base.FormatPart(typeName, identifierPart, withQuotes);
+        }
+    }
+}

=== modified file 'MySql.VisualStudio/MySql.VisualStudio.csproj'
--- a/MySql.VisualStudio/MySql.VisualStudio.csproj	2009-11-10 22:01:16 +0000
+++ b/MySql.VisualStudio/MySql.VisualStudio.csproj	2010-07-02 18:36:52 +0000
@@ -140,6 +140,7 @@
       <DependentUpon>MySqlDataConnectionPromptDialog.cs</DependentUpon>
     </Compile>
     <Compile Include="DDEX\MySqlDataObjectEnumerator.cs" />
+    <Compile Include="DDEX\MySqlDataObjectIdentifierConverter.cs" />
     <Compile Include="DDEX\MySqlDataObjectSupport.cs" />
     <Compile Include="DDEX\MySqlDataSourceInformation.cs" />
     <Compile Include="DDEX\MySqlDataSourceSpecializer.cs" />

Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20100702183652-mshwvhrlud3ifoik.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:822) Bug#33870Reggie Burnett2 Jul