|
From: <fab...@us...> - 2009-06-15 06:50:02
|
Revision: 4479
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4479&view=rev
Author: fabiomaulo
Date: 2009-06-15 06:49:59 +0000 (Mon, 15 Jun 2009)
Log Message:
-----------
Fixed the incompatibility of SqlType (now the SqlClientDrive with prepare_sql should work properly)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/SimpleValue.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeSqlTypeFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/SimpleValue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/SimpleValue.cs 2009-06-15 06:22:40 UTC (rev 4478)
+++ trunk/nhibernate/src/NHibernate/Mapping/SimpleValue.cs 2009-06-15 06:49:59 UTC (rev 4479)
@@ -228,7 +228,7 @@
{
throw new MappingException("No type name specified");
}
- type = TypeFactory.HeuristicType(typeName, typeParameters);
+ type = GetHeuristicType();
if (type == null)
{
string msg = "Could not determine type for: " + typeName;
@@ -243,6 +243,29 @@
}
}
+ private IType GetHeuristicType()
+ {
+ // NH different behavior
+ // If the mapping has a type as "Double(10,5)" our SqlType will be created with all information
+ // including the rigth SqlType specification but when the length/presion/scale was specified
+ // trough attributes the SqlType is wrong (does not include length/presion/scale specification)
+
+ IType result = null;
+ if (ColumnSpan == 1 && !columns[0].IsFormula)
+ {
+ var col = (Column) columns[0];
+ if(col.IsLengthDefined())
+ {
+ result = TypeFactory.BuiltInType(typeName, col.Length);
+ }
+ else if(col.IsPrecisionDefined())
+ {
+ result = TypeFactory.BuiltInType(typeName, Convert.ToByte(col.Precision), Convert.ToByte(col.Scale));
+ }
+ }
+ return result ?? TypeFactory.HeuristicType(typeName, typeParameters);
+ }
+
public bool HasFormula
{
get
Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeSqlTypeFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeSqlTypeFixture.cs 2009-06-15 06:22:40 UTC (rev 4478)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeSqlTypeFixture.cs 2009-06-15 06:49:59 UTC (rev 4479)
@@ -92,7 +92,7 @@
}
}
- [TestFixture, Ignore("Not fixed yet.")]
+ [TestFixture]
public class FixtureWithExplicitDefinedType : TypeSqlTypeFixture
{
protected override string GetResourceName()
@@ -101,7 +101,7 @@
}
}
- [TestFixture, Ignore("Not fixed yet.")]
+ [TestFixture]
public class FixtureWithHeuristicDefinedType : TypeSqlTypeFixture
{
protected override string GetResourceName()
@@ -119,7 +119,7 @@
}
}
- [TestFixture, Ignore("Not fixed yet.")]
+ [TestFixture]
public class FixtureWithColumnNode : TypeSqlTypeFixture
{
protected override string GetResourceName()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|