List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:December 9 2010 3:26am
Subject:bzr commit into connector-net-6.0 branch (reggie.burnett:851) Bug#55349
View as plain text  
#At file:///C:/work/connector-net/6.0/ based on revid:reggie.burnett@stripped

  851 Reggie Burnett	2010-12-08
      - fixed bug where older versions of MySQL would present cast(0 as decimal(0,0)) as string 
        that caused our EF code to throw an exception as it tried to convert that to bool
        (bug #55349)

    modified:
      CHANGES
      MySql.Data.Entity/Provider/EFMySqlDataReader.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-11-30 18:28:31 +0000
+++ b/CHANGES	2010-12-09 03:26:38 +0000
@@ -10,6 +10,9 @@
 - fixed our DDEX code so that dragging tables from server explorer onto a typed data set
   preserves the table name (bug #57894)
 - fixed ReadFieldLength to return a long so bigint autoincrement columns can work (bug #58373)
+- fixed bug where older versions of MySQL would present cast(0 as decimal(0,0)) as string 
+  that caused our EF code to throw an exception as it tried to convert that to bool
+  (bug #55349)
 
 Version 6.0.7
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data.Entity/Provider/EFMySqlDataReader.cs'
--- a/MySql.Data.Entity/Provider/EFMySqlDataReader.cs	2009-09-01 00:49:03 +0000
+++ b/MySql.Data.Entity/Provider/EFMySqlDataReader.cs	2010-12-09 03:26:38 +0000
@@ -25,6 +25,7 @@
 using System.Data;
 using System.Data.Metadata.Edm;
 using System.Globalization;
+using System.Text;
 
 namespace MySql.Data.Entity
 {
@@ -205,9 +206,15 @@
 
         private object ChangeType(object sourceValue, Type targetType)
         {
-            if (sourceValue is byte[] && targetType == typeof(Guid))
+            if (sourceValue is byte[])
             {
-                return new Guid((byte[])sourceValue);
+				if (targetType == typeof(Guid))
+					return new Guid((byte[])sourceValue);
+				else if (targetType == typeof(bool))
+				{
+					byte[] bytes = (byte[])sourceValue;
+					return bytes[0] == '1';
+				}
             }
 
             if (sourceValue is DateTime && targetType == typeof(DateTimeOffset))


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20101209032638-gyrli5yr5lik7jjr.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:851) Bug#55349Reggie Burnett9 Dec