List:Commits« Previous MessageNext Message »
From:rburnett Date:May 7 2008 10:21pm
Subject:Connector/NET commit: r1295 - in branches/5.1: . VisualStudio/Descriptors
View as plain text  
Modified:
   branches/5.1/CHANGES
   branches/5.1/VisualStudio/Descriptors/ColumnDescriptor.cs
Log:
 - Fixed problem with DDEX provider that could sometimes prevent table altering when
working with 4.1 servers (bug #30603)


Modified: branches/5.1/CHANGES
===================================================================
--- branches/5.1/CHANGES	2008-05-07 19:25:21 UTC (rev 1294)
+++ branches/5.1/CHANGES	2008-05-07 20:21:52 UTC (rev 1295)
@@ -1,4 +1,8 @@
-Version 5.1.6 
+Version 5.1.7
+ - Fixed problem with DDEX provider that could sometimes prevent table altering when
working with
+   4.1 servers (bug #30603)
+
+Version 5.1.6 - 5/7/08
  - Fixed problem where parameters lists were not showing when you tried to alter a
routine 
    in server explorer.  (bug #34359)
  - Fixed a problem in procedure cache where it was possible to get into a race condition

Modified: branches/5.1/VisualStudio/Descriptors/ColumnDescriptor.cs
===================================================================
--- branches/5.1/VisualStudio/Descriptors/ColumnDescriptor.cs	2008-05-07 19:25:21 UTC (rev
1294)
+++ branches/5.1/VisualStudio/Descriptors/ColumnDescriptor.cs	2008-05-07 20:21:52 UTC (rev
1295)
@@ -258,6 +258,39 @@
             return merged;
         }
 
+        DataTable ConvertTableIfNecessary(DataTable table)
+        {
+            DataTable newResult = null;
+            foreach (DataColumn col in table.Columns)
+            {
+                if (col.DataType == typeof(byte[]))
+                {
+                    newResult = table.Clone();
+                    break;
+                }
+            }
+            if (newResult == null) return table;
+
+            foreach (DataColumn col in newResult.Columns)
+            {
+                if (col.DataType == typeof(byte[]))
+                    col.DataType = typeof(String);
+            }
+
+            for (int row = 0; row < table.Rows.Count; row++)
+            {
+                DataRow newRow = newResult.NewRow();
+                DataRow oldRow = table.Rows[row];
+                for (int col = 0; col < table.Columns.Count; col++)
+                {
+                    if (oldRow[col] is byte[])
+                        newRow[col] = Encoding.UTF8.GetString((byte[])oldRow[col]);
+                }
+                newResult.Rows.Add(newRow);
+            }
+            return newResult;
+        }
+
         /// <summary>
         /// Returns DataTable with description of table's columns.
         /// </summary>
@@ -270,6 +303,10 @@
             // Execute base method
             DataTable result = base.ReadTable(connection, restrictions, sort);
 
+            // hackity, hack, hack.  We are just doing this so we can avoid having to
rewrite a ton
+            // of code to use a data reader to work around the server stupid binary
issues.
+            result = ConvertTableIfNecessary(result);
+
             // If result is null, exit
             if (result == null)
                 return null;

Thread
Connector/NET commit: r1295 - in branches/5.1: . VisualStudio/Descriptorsrburnett7 May