Author: gbayon
Date: Fri Nov 11 12:24:27 2005
New Revision: 332639
URL: http://svn.apache.org/viewcvs?rev=332639&view=rev
Log:
- Fixed IBATISNET-126
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Other.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Other.xml
Fri Nov 11 12:24:27 2005
@@ -140,7 +140,22 @@
from Others
Where Other_Int = #value#
</statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=Varchar#)
+ </statement>
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Other.xml
Fri Nov 11 12:24:27 2005
@@ -137,7 +137,22 @@
from Others
Where Other_Int = #value#
</statement>
-
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Other.xml
Fri Nov 11 12:24:27 2005
@@ -145,6 +145,22 @@
from Others
Where Other_Int = #value#
</statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
Fri Nov 11 12:24:27 2005
@@ -120,14 +120,7 @@
values
( #Int#, #Long#, #Bool#, 'Yes')
</statement>
-
- <statement id="InsertCustomTypeHandler"
- parameterMap="insert-params">
- Insert into Others
- ( Other_Int, Other_Long, Other_Bit,
Other_String )
- values
- ( ?, ?, ?, ?)
- </statement>
+
<statement id="SelectByInt"
parameterClass="int"
@@ -141,6 +134,29 @@
Where Other_Int = #value#
</statement>
+ <statement id="InsertCustomTypeHandler"
+ parameterMap="insert-params">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( ?, ?, ?, ?)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Other.xml
Fri Nov 11 12:24:27 2005
@@ -140,7 +140,22 @@
from Others
Where Other_Int = #value#
</statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=varchar#)
+ </statement>
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Other.xml
Fri Nov 11 12:24:27 2005
@@ -140,6 +140,22 @@
from Others
Where Other_Int = #value#
</statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=Varchar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Other.xml
Fri Nov 11 12:24:27 2005
@@ -153,7 +153,22 @@
from Others
Where Other_Int = #value#
</statement>
-
+
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=VarChar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Other.xml
Fri Nov 11 12:24:27 2005
@@ -142,6 +142,21 @@
Where Other_Int = #value#
</statement>
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#,
#Bool2,type=bool,dbType=VarChar#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Other.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Other.xml?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Other.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Other.xml
Fri Nov 11 12:24:27 2005
@@ -138,6 +138,21 @@
Where Other_Int = #value#
</statement>
+ <statement id="InsertInlineCustomTypeHandlerV1"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,type=bool,dbType=Text#)
+ </statement>
+
+ <statement id="InsertInlineCustomTypeHandlerV2"
+ parameterClass="Other">
+ Insert into Others
+ ( Other_Int, Other_Long, Other_Bit,
Other_String )
+ values
+ ( #Int#, #Long#, #Bool#, #Bool2,handler=OuiNonBool#)
+ </statement>
</statements>
<parameterMaps>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
Fri Nov 11 12:24:27 2005
@@ -1325,6 +1325,52 @@
Assert.AreEqual(true, anOther.Bool);
Assert.AreEqual(false, anOther.Bool2);
}
+
+ /// <summary>
+ /// Test CustomTypeHandler Oui/Non
+ /// </summary>
+ [Test]
+ public void TestInsertInlineCustomTypeHandlerV1()
+ {
+ Other other = new Other();
+ other.Int = 99;
+ other.Long = 1966;
+ other.Bool = true;
+ other.Bool2 = false;
+
+ sqlMap.Insert("InsertInlineCustomTypeHandlerV1", other);
+
+ Other anOther = sqlMap.QueryForObject("SelectByInt",
99) as Other;
+
+ Assert.IsNotNull( anOther );
+ Assert.AreEqual(99, anOther.Int);
+ Assert.AreEqual(1966, anOther.Long);
+ Assert.AreEqual(true, anOther.Bool);
+ Assert.AreEqual(false, anOther.Bool2);
+ }
+
+ /// <summary>
+ /// Test CustomTypeHandler Oui/Non
+ /// </summary>
+ [Test]
+ public void TestInsertInlineCustomTypeHandlerV2()
+ {
+ Other other = new Other();
+ other.Int = 99;
+ other.Long = 1966;
+ other.Bool = true;
+ other.Bool2 = false;
+
+ sqlMap.Insert("InsertInlineCustomTypeHandlerV2", other);
+
+ Other anOther = sqlMap.QueryForObject("SelectByInt",
99) as Other;
+
+ Assert.IsNotNull( anOther );
+ Assert.AreEqual(99, anOther.Int);
+ Assert.AreEqual(1966, anOther.Long);
+ Assert.AreEqual(true, anOther.Bool);
+ Assert.AreEqual(false, anOther.Bool2);
+ }
#endregion
}
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Fri Nov 11 12:24:27 2005
@@ -297,7 +297,7 @@
public DomSqlMapBuilder()
{
_configScope = new ConfigurationScope();
- _paramParser = new
InlineParameterMapParser(_configScope.ErrorContext);
+ _paramParser = new
InlineParameterMapParser(_configScope);
_deSerializerFactory = new
DeSerializerFactory(_configScope);
}
@@ -314,7 +314,7 @@
{
_configScope = new ConfigurationScope();
_configScope.ValidateSqlMapConfig =
validateSqlMapConfig;
- _paramParser = new
InlineParameterMapParser(_configScope.ErrorContext);
+ _paramParser = new InlineParameterMapParser(
_configScope );
}
#endregion
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
Fri Nov 11 12:24:27 2005
@@ -52,7 +52,7 @@
private const string PARAMETER_TOKEN = "#";
private const string PARAM_DELIM = ":";
- private ErrorContext _errorContext= null;
+ private ConfigurationScope _configScope = null;
#endregion
@@ -61,10 +61,10 @@
/// <summary>
/// Constructor
/// </summary>
- /// <param name="errorContext"></param>
- public InlineParameterMapParser(ErrorContext errorContext)
+ /// <param name="configScope"></param>
+ public InlineParameterMapParser(ConfigurationScope configScope)
{
- _errorContext = errorContext;
+ _configScope = configScope;
}
#endregion
@@ -208,9 +208,11 @@
}
}
- mapping.Initialize(typeHandlerFactory, _errorContext);
-
- if (mapping.TypeHandler is UnknownTypeHandler)
+ if (mapping.CallBackName.Length >0)
+ {
+ mapping.Initialize( _configScope );
+ }
+ else
{
ITypeHandler handler = null;
if (parameterClassType == null)
@@ -224,6 +226,7 @@
mapping.CLRType, mapping.DbType
);
}
mapping.TypeHandler = handler;
+ mapping.Initialize( _configScope );
}
return mapping;
@@ -235,10 +238,10 @@
/// #propertyName:dbType:nullValue#
/// </summary>
/// <param name="token"></param>
- /// <param name="parameterClass"></param>
+ /// <param name="parameterClassType"></param>
/// <param name="typeHandlerFactory"></param>
/// <returns></returns>
- private ParameterProperty OldParseMapping(string token, Type
parameterClass, TypeHandlerFactory typeHandlerFactory)
+ private ParameterProperty OldParseMapping(string token, Type
parameterClassType, TypeHandlerFactory typeHandlerFactory)
{
ParameterProperty mapping = new ParameterProperty();
@@ -260,16 +263,16 @@
mapping.DbType = dBType;
ITypeHandler handler = null;
- if (parameterClass == null)
+ if (parameterClassType == null)
{
handler =
typeHandlerFactory.GetUnkownTypeHandler();
}
else
{
- handler =
ResolveTypeHandler(typeHandlerFactory, parameterClass, propertyName, null,
dBType);
+ handler =
ResolveTypeHandler(typeHandlerFactory, parameterClassType, propertyName, null,
dBType);
}
mapping.TypeHandler = handler;
- mapping.Initialize(typeHandlerFactory,
_errorContext);
+ mapping.Initialize(
_configScope.ErrorContext );
}
else if (n1 >= 5)
{
@@ -290,16 +293,16 @@
mapping.DbType = dBType;
mapping.NullValue = nullValue;
ITypeHandler handler = null;
- if (parameterClass == null)
+ if (parameterClassType == null)
{
handler =
typeHandlerFactory.GetUnkownTypeHandler();
}
else
{
- handler =
ResolveTypeHandler(typeHandlerFactory, parameterClass, propertyName, null,
dBType);
+ handler =
ResolveTypeHandler(typeHandlerFactory, parameterClassType, propertyName, null,
dBType);
}
mapping.TypeHandler = handler;
- mapping.Initialize(typeHandlerFactory,
_errorContext);
+ mapping.Initialize(
_configScope.ErrorContext );
}
else
{
@@ -310,16 +313,16 @@
{
mapping.PropertyName = token;
ITypeHandler handler = null;
- if (parameterClass == null)
+ if (parameterClassType == null)
{
handler =
typeHandlerFactory.GetUnkownTypeHandler();
}
else
{
- handler =
ResolveTypeHandler(typeHandlerFactory, parameterClass, token, null, null);
+ handler =
ResolveTypeHandler(typeHandlerFactory, parameterClassType, token, null, null);
}
mapping.TypeHandler = handler;
- mapping.Initialize(typeHandlerFactory,
_errorContext);
+ mapping.Initialize( _configScope.ErrorContext );
}
return mapping;
}
@@ -328,23 +331,23 @@
/// <summary>
/// Resolve TypeHandler
/// </summary>
- /// <param name="paremeterClassType"></param>
+ /// <param name="parameterClassType"></param>
/// <param name="propertyName"></param>
/// <param name="propertyType"></param>
/// <param name="dbType"></param>
/// <param name="typeHandlerFactory"></param>
/// <returns></returns>
private ITypeHandler ResolveTypeHandler(TypeHandlerFactory
typeHandlerFactory,
- Type paremeterClassType, string propertyName,
+ Type parameterClassType, string propertyName,
string propertyType, string dbType)
{
ITypeHandler handler = null;
- if (paremeterClassType == null)
+ if (parameterClassType == null)
{
handler =
typeHandlerFactory.GetUnkownTypeHandler();
}
- else if
(typeof(IDictionary).IsAssignableFrom(paremeterClassType))
+ else if
(typeof(IDictionary).IsAssignableFrom(parameterClassType))
{
if (propertyType == null ||
propertyType.Length==0)
{
@@ -363,13 +366,13 @@
}
}
}
- else if
(typeHandlerFactory.GetTypeHandler(paremeterClassType, dbType) != null)
+ else if
(typeHandlerFactory.GetTypeHandler(parameterClassType, dbType) != null)
{
- handler =
typeHandlerFactory.GetTypeHandler(paremeterClassType, dbType);
+ handler =
typeHandlerFactory.GetTypeHandler(parameterClassType, dbType);
}
else
{
- Type typeClass =
ObjectProbe.GetPropertyTypeForGetter(paremeterClassType, propertyName);
+ Type typeClass =
ObjectProbe.GetPropertyTypeForGetter(parameterClassType, propertyName);
handler =
typeHandlerFactory.GetTypeHandler(typeClass, dbType);
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
Fri Nov 11 12:24:27 2005
@@ -297,35 +297,15 @@
///
/// </summary>
/// <param name="errorContext"></param>
- /// <param name="typeHandlerFactory"></param>
- internal void Initialize(TypeHandlerFactory typeHandlerFactory,
ErrorContext errorContext)
+ internal void Initialize(ErrorContext errorContext)
{
+ errorContext.MoreInfo = "Initialize an inline parameter
property '" + this.PropertyName + "' .";
+
if(_directionAttribute.Length >0)
{
_direction = (ParameterDirection)Enum.Parse(
typeof(ParameterDirection), _directionAttribute, true );
}
- errorContext.MoreInfo = "Initialize an inline parameter
property '" + this.PropertyName + "' .";
- if (this.CLRType.Length == 0 ) // Unknown
- {
- _typeHandler =
typeHandlerFactory.GetUnkownTypeHandler();
- }
- else // If we specify a CLR type, use it
- {
- Type type = Resources.TypeForName(this.CLRType);
-
- if (typeHandlerFactory.IsSimpleType(type))
- {
- // Primitive
- _typeHandler =
typeHandlerFactory.GetTypeHandler(type);
- }
- else
- {
- // .NET object
- type =
ObjectProbe.GetPropertyTypeForGetter(type, this.PropertyName);
- _typeHandler =
typeHandlerFactory.GetTypeHandler(type);
- }
- }
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs?rev=332639&r1=332638&r2=332639&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
Fri Nov 11 12:24:27 2005
@@ -25,19 +25,16 @@
#endregion
#region Imports
-using System;
+
using System.Collections;
using System.Text;
-
using IBatisNet.Common;
-using IBatisNet.DataMapper.Configuration.Sql;
-using IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic;
-using IBatisNet.DataMapper.Configuration.Statements;
using IBatisNet.DataMapper.Configuration.ParameterMapping;
using IBatisNet.DataMapper.Configuration.Sql.Dynamic.Elements;
using IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers;
+using IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic;
+using IBatisNet.DataMapper.Configuration.Statements;
using IBatisNet.DataMapper.Scope;
-using IBatisNet.DataMapper.TypeHandlers;
#endregion
@@ -57,7 +54,7 @@
private IList _children = new ArrayList();
private IStatement _statement = null ;
private InlineParameterMapParser _paramParser = null;
- private TypeHandlerFactory _typeHandlerFactory = null;
+ private ConfigurationScope _configScope = null;
private bool _usePositionalParameters = false;
#endregion
@@ -71,7 +68,7 @@
internal DynamicSql(ConfigurationScope configScope, IStatement
statement)
{
_statement = statement;
- _typeHandlerFactory = configScope.TypeHandlerFactory;
+ _configScope = configScope;
_usePositionalParameters =
configScope.DataSource.Provider.UsePositionalParameters;
}
#endregion
@@ -102,7 +99,7 @@
public RequestScope GetRequestScope(object parameterObject,
IDalSession session)
{
RequestScope request = new RequestScope();
- _paramParser = new
InlineParameterMapParser(request.ErrorContext);
+ _paramParser = new InlineParameterMapParser(
_configScope );
request.ResultMap = _statement.ResultMap;
string sqlStatement = Process(request, parameterObject);
@@ -144,7 +141,7 @@
// Processes $substitutions$ after DynamicSql
if ( SimpleDynamicSql.IsSimpleDynamicSql(dynSql) )
{
- dynSql = new
SimpleDynamicSql(_typeHandlerFactory, dynSql,
_statement).GetSql(parameterObject);
+ dynSql = new
SimpleDynamicSql(_configScope.TypeHandlerFactory, dynSql,
_statement).GetSql(parameterObject);
}
return dynSql;
}
@@ -251,7 +248,7 @@
if
(handler.IsPostParseRequired)
{
-
SqlText sqlText = _paramParser.ParseInlineParameterMap(_typeHandlerFactory,
null, body.ToString() );
+
SqlText sqlText =
_paramParser.ParseInlineParameterMap(_configScope.TypeHandlerFactory, null,
body.ToString() );
buffer.Append(sqlText.Text);
ParameterProperty[] mappings = sqlText.Parameters;
if (mappings != null)