MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:rburnett Date:April 1 2009 12:51am
Subject:Connector/NET commit: r1542 - in trunk: . MySql.Data.Entity/Provider MySql.Data.Entity/Provider/Generators
View as plain text  
Modified:
   trunk/CHANGES
   trunk/MySql.Data.Entity/Provider/Generators/SqlGenerator.cs
   trunk/MySql.Data.Entity/Provider/Metadata.cs
Log:
- fixed problem in sql generation that caused decimal values to be generated incorrectly
  when using a certain cultures (bug #43574)


Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2009-03-31 23:15:46 UTC (rev 1541)
+++ trunk/CHANGES	2009-04-01 00:51:34 UTC (rev 1542)
@@ -5,6 +5,8 @@
 - Changed entity framework generation so that schemas are not written out.  This allows
   a single model to swing from one database to another by just changing the connection
   string (bug #43274)
+- fixed problem in sql generation that caused decimal values to be generated incorrectly
+  when using a certain cultures (bug #43574)
 
 Version 6.0
 - Massive speedups

Modified: trunk/MySql.Data.Entity/Provider/Generators/SqlGenerator.cs
===================================================================
--- trunk/MySql.Data.Entity/Provider/Generators/SqlGenerator.cs	2009-03-31 23:15:46 UTC (rev 1541)
+++ trunk/MySql.Data.Entity/Provider/Generators/SqlGenerator.cs	2009-04-01 00:51:34 UTC (rev 1542)
@@ -26,6 +26,7 @@
 using System.Data.Common.CommandTrees;
 using System.Data.Metadata.Edm;
 using MySql.Data.MySqlClient;
+using System.Globalization;
 
 namespace MySql.Data.Entity
 {
@@ -149,6 +150,11 @@
             PrimitiveTypeKind pt = ((PrimitiveType)expression.ResultType.EdmType).PrimitiveTypeKind;
             if (Metadata.IsNumericType(expression.ResultType))
                 return new LiteralFragment(expression.Value.ToString());
+            else if (pt == PrimitiveTypeKind.Decimal)
+            {
+                decimal val = (decimal)expression.Value;
+                return new LiteralFragment(val.ToString(CultureInfo.InvariantCulture));
+            }
             else if (pt == PrimitiveTypeKind.Boolean)
                 return new LiteralFragment(String.Format("cast({0} as decimal(0,0))",
                     (bool)expression.Value ? 1 : 0));

Modified: trunk/MySql.Data.Entity/Provider/Metadata.cs
===================================================================
--- trunk/MySql.Data.Entity/Provider/Metadata.cs	2009-03-31 23:15:46 UTC (rev 1541)
+++ trunk/MySql.Data.Entity/Provider/Metadata.cs	2009-04-01 00:51:34 UTC (rev 1542)
@@ -35,7 +35,6 @@
             switch (pt.PrimitiveTypeKind)
             {
                 case PrimitiveTypeKind.Byte:
-                case PrimitiveTypeKind.Decimal:
                 case PrimitiveTypeKind.Double:
                 case PrimitiveTypeKind.Single:
                 case PrimitiveTypeKind.Int16:

Thread
Connector/NET commit: r1542 - in trunk: . MySql.Data.Entity/Provider MySql.Data.Entity/Provider/Generatorsrburnett1 Apr