You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2006/06/26 20:21:13 UTC
svn commit: r417269 - in /ibatis/trunk/cs/mapper:
IBatisNet.DataAccess/DaoSessionHandlers/
IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/
IBatisNet.DataMapper.Test/NUnit/SqlMapTests/
IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ IBatisNet.DataM...
Author: gbayon
Date: Mon Jun 26 11:21:12 2006
New Revision: 417269
URL: http://svn.apache.org/viewvc?rev=417269&view=rev
Log:
- Fixed IBATISNET-164
- Generalized ISqlMapper usage
Added:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs (with props)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs (with props)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs (with props)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs (with props)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs (with props)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs (with props)
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/ResultClass.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/StatementGenerate.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Mapper.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataAccess/DaoSessionHandlers/SqlMapDaoSessionHandler.cs Mon Jun 26 11:21:12 2006
@@ -47,14 +47,14 @@
public class SqlMapDaoSessionHandler : IDaoSessionHandler
{
#region Fields
- private SqlMapper _sqlMap;
+ private ISqlMapper _sqlMap;
#endregion
#region Properties
/// <summary>
///
/// </summary>
- public SqlMapper SqlMap
+ public ISqlMapper SqlMap
{
get { return _sqlMap; }
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/ResultClass.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/ResultClass.xml?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/ResultClass.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/ResultClass.xml Mon Jun 26 11:21:12 2006
@@ -7,8 +7,8 @@
<statement id="GetBoolean"
parameterClass="Int"
resultClass="bool" >
- select 1 from Orders where Order_ID = #dummy#
- </statement>
+ select TRUE from Orders where Order_ID = #dummy#
+ </statement>
<statement id="GetBooleanWithoutResultClass"
parameterClass="Int"
extends="GetBoolean">
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs Mon Jun 26 11:21:12 2006
@@ -50,7 +50,7 @@
properties.Add("nullableInt", "int");
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( _fileName );
+ ISqlMapper mapper = builder.Configure(_fileName);
Assert.IsNotNull(mapper);
}
@@ -72,7 +72,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler);
Assert.IsNotNull(mapper);
}
@@ -91,7 +91,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( _fileName );
+ ISqlMapper mapper = builder.Configure(_fileName);
Assert.IsNotNull(mapper);
}
@@ -112,7 +112,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler);
Assert.IsNotNull(mapper);
}
@@ -135,7 +135,7 @@
properties.Add("nullableInt", "int");
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( _fileName );
+ ISqlMapper mapper = builder.Configure(_fileName);
Assert.IsNotNull(mapper);
}
@@ -156,7 +156,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( _fileName );
+ ISqlMapper mapper = builder.Configure(_fileName);
Assert.IsNotNull(mapper);
}
@@ -177,7 +177,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( _fileName );
+ ISqlMapper mapper = builder.Configure(_fileName);
Assert.IsNotNull(mapper);
}
@@ -198,7 +198,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( _fileName );
+ ISqlMapper mapper = builder.Configure(_fileName);
Assert.IsNotNull(mapper);
}
@@ -220,7 +220,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( fileInfo );
+ ISqlMapper mapper = builder.Configure(fileInfo);
Assert.IsNotNull(mapper);
}
@@ -242,7 +242,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( uri );
+ ISqlMapper mapper = builder.Configure(uri);
Assert.IsNotNull(mapper);
}
@@ -264,7 +264,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler);
Assert.IsNotNull(mapper);
}
@@ -286,7 +286,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler);
Assert.IsNotNull(mapper);
}
@@ -308,7 +308,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler);
Assert.IsNotNull(mapper);
}
@@ -330,7 +330,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(_fileName, handler);
Assert.IsNotNull(mapper);
}
@@ -354,7 +354,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.ConfigureAndWatch( fileInfo , handler);
+ ISqlMapper mapper = builder.ConfigureAndWatch(fileInfo, handler);
Assert.IsNotNull(mapper);
}
@@ -385,7 +385,7 @@
builder.Properties = properties;
- SqlMapper mapper = builder.Configure( stream );
+ ISqlMapper mapper = builder.Configure(stream);
Assert.IsNotNull(mapper);
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/StatementGenerate.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/StatementGenerate.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/StatementGenerate.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/StatementGenerate.cs Mon Jun 26 11:21:12 2006
@@ -79,7 +79,7 @@
IList categorieList = sqlMap.QueryForList("SelectAllCategoryGenerate",null) as IList;
Assert.AreEqual(2, categorieList.Count);
-
+ Assert.AreEqual("toto", ((Category)categorieList[0]).Name);
}
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Mon Jun 26 11:21:12 2006
@@ -383,7 +383,7 @@
/// </summary>
/// <returns>An SqlMap</returns>
/// <remarks>The file path is relative to the application root.</remarks>
- public SqlMapper Configure()
+ public ISqlMapper Configure()
{
return Configure( Resources.GetConfigAsXmlDocument(DomSqlMapBuilder.DEFAULT_FILE_CONFIG_NAME) );
}
@@ -394,7 +394,7 @@
/// </summary>
/// <param name="document">An xml sql map configuration document.</param>
/// <returns>the SqlMap</returns>
- public SqlMapper Configure( XmlDocument document )
+ public ISqlMapper Configure(XmlDocument document)
{
return Build( document, false );
}
@@ -408,7 +408,7 @@
/// or a absolue file path file:\\c:\dir\a.config
/// </param>
/// <returns>An SqlMap</returns>
- public SqlMapper Configure(string resource)
+ public ISqlMapper Configure(string resource)
{
XmlDocument document = null;
if (resource.StartsWith("file://"))
@@ -428,7 +428,7 @@
/// </summary>
/// <param name="resource">A stream resource</param>
/// <returns>An SqlMap</returns>
- public SqlMapper Configure(Stream resource)
+ public ISqlMapper Configure(Stream resource)
{
XmlDocument document = Resources.GetStreamAsXmlDocument( resource );
return Build( document, false);
@@ -440,7 +440,7 @@
/// </summary>
/// <param name="resource">A FileInfo resource</param>
/// <returns>An SqlMap</returns>
- public SqlMapper Configure(FileInfo resource)
+ public ISqlMapper Configure(FileInfo resource)
{
XmlDocument document = Resources.GetFileInfoAsXmlDocument( resource );
return Build( document, false);
@@ -452,7 +452,7 @@
/// </summary>
/// <param name="resource">A Uri resource</param>
/// <returns></returns>
- public SqlMapper Configure(Uri resource)
+ public ISqlMapper Configure(Uri resource)
{
XmlDocument document = Resources.GetUriAsXmlDocument( resource );
return Build( document, false);
@@ -464,7 +464,7 @@
/// and automatically reconfigure SqlMap.
/// </summary>
/// <returns>An SqlMap</returns>
- public SqlMapper ConfigureAndWatch(ConfigureHandler configureDelegate)
+ public ISqlMapper ConfigureAndWatch(ConfigureHandler configureDelegate)
{
return ConfigureAndWatch( DEFAULT_FILE_CONFIG_NAME, configureDelegate ) ;
}
@@ -482,7 +482,7 @@
/// Delegate called when the file has changed, to rebuild the dal.
/// </param>
/// <returns>An SqlMap</returns>
- public SqlMapper ConfigureAndWatch( string resource, ConfigureHandler configureDelegate )
+ public ISqlMapper ConfigureAndWatch( string resource, ConfigureHandler configureDelegate )
{
XmlDocument document = null;
if (resource.StartsWith("file://"))
@@ -520,7 +520,7 @@
/// Delegate called when the file has changed, to rebuild the dal.
/// </param>
/// <returns>An SqlMap</returns>
- public SqlMapper ConfigureAndWatch( FileInfo resource, ConfigureHandler configureDelegate )
+ public ISqlMapper ConfigureAndWatch( FileInfo resource, ConfigureHandler configureDelegate )
{
XmlDocument document = Resources.GetFileInfoAsXmlDocument(resource);
@@ -561,7 +561,7 @@
/// <param name="useConfigFileWatcher"></param>
/// <param name="isCallFromDao"></param>
/// <returns>return an a SqlMapper instance</returns>
- private SqlMapper Build(XmlDocument document,DataSource dataSource,
+ private ISqlMapper Build(XmlDocument document,DataSource dataSource,
bool useConfigFileWatcher, bool isCallFromDao)
{
_configScope.SqlMapConfigDocument = document;
@@ -673,7 +673,7 @@
/// <param name="properties"></param>
/// <returns></returns>
/// <remarks>Used by Dao</remarks>
- public SqlMapper Build(XmlDocument document, DataSource dataSource, bool useConfigFileWatcher, NameValueCollection properties)
+ public ISqlMapper Build(XmlDocument document, DataSource dataSource, bool useConfigFileWatcher, NameValueCollection properties)
{
_configScope.Properties.Add(properties);
return Build(document, dataSource, useConfigFileWatcher, true);
@@ -686,7 +686,7 @@
/// </summary>
/// <param name="document">The xml sql map configuration.</param>
/// <param name="useConfigFileWatcher"></param>
- public SqlMapper Build(XmlDocument document, bool useConfigFileWatcher)
+ public ISqlMapper Build(XmlDocument document, bool useConfigFileWatcher)
{
return Build(document, null, useConfigFileWatcher, false);
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj Mon Jun 26 11:21:12 2006
@@ -624,6 +624,9 @@
<Compile Include="TypeHandlers\Nullables\NullableInt32TypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableInt64TypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableSingleTypeHandler.cs" />
+ <Compile Include="TypeHandlers\Nullables\NullableUInt16TypeHandler.cs" />
+ <Compile Include="TypeHandlers\Nullables\NullableUInt32TypeHandler.cs" />
+ <Compile Include="TypeHandlers\Nullables\NullableUInt64TypeHandler.cs" />
<Compile Include="TypeHandlers\ObjectTypeHandler.cs">
<SubType>Code</SubType>
</Compile>
@@ -645,6 +648,9 @@
<Compile Include="TypeHandlers\TypeHandlerFactory.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="TypeHandlers\UInt16TypeHandler.cs" />
+ <Compile Include="TypeHandlers\UInt32TypeHandler.cs" />
+ <Compile Include="TypeHandlers\UInt64TypeHandler.cs" />
<Compile Include="TypeHandlers\UnknownTypeHandler.cs">
<SubType>Code</SubType>
</Compile>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Mapper.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Mapper.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Mapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Mapper.cs Mon Jun 26 11:21:12 2006
@@ -1,7 +1,7 @@
#region Apache Notice
/*****************************************************************************
* $Header: $
- * $Revision: $
+ * $Revision$
* $Date$
*
* iBATIS.NET Data Mapper
@@ -35,7 +35,7 @@
public class Mapper
{
#region Fields
- private static volatile SqlMapper _mapper = null;
+ private static volatile ISqlMapper _mapper = null;
#endregion
/// <summary>
@@ -60,7 +60,7 @@
/// Get the instance of the SqlMapper defined by the SqlMap.Config file.
/// </summary>
/// <returns>A SqlMapper initalized via the SqlMap.Config file.</returns>
- public static SqlMapper Instance()
+ public static ISqlMapper Instance()
{
if (_mapper == null)
{
@@ -79,7 +79,7 @@
/// Get the instance of the SqlMapper defined by the SqlMap.Config file. (Convenience form of Instance method.)
/// </summary>
/// <returns>A SqlMapper initalized via the SqlMap.Config file.</returns>
- public static SqlMapper Get()
+ public static ISqlMapper Get()
{
return Instance();
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Mon Jun 26 11:21:12 2006
@@ -215,7 +215,7 @@
/// <param name="document">An xml sql map configuration document.</param>
/// <returns>the SqlMap</returns>
[Obsolete("This method will be remove in next version, use DomSqlMapBuilder.Configure.", false)]
- static public SqlMapper Configure( XmlDocument document )
+ static public ISqlMapper Configure(XmlDocument document)
{
return new DomSqlMapBuilder().Build( document, false );
}
@@ -226,7 +226,7 @@
/// <returns>An SqlMap</returns>
/// <remarks>The file path is relative to the application root.</remarks>
[Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
- static public SqlMapper Configure()
+ static public ISqlMapper Configure()
{
return Configure( Resources.GetConfigAsXmlDocument(DomSqlMapBuilder.DEFAULT_FILE_CONFIG_NAME) );
}
@@ -241,7 +241,7 @@
/// </param>
/// <returns>An SqlMap</returns>
[Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
- public static SqlMapper Configure(string resource)
+ public static ISqlMapper Configure(string resource)
{
XmlDocument document = null;
if (resource.StartsWith("file://"))
@@ -262,7 +262,7 @@
/// </summary>
/// <returns>An SqlMap</returns>
[Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
- public static SqlMapper ConfigureAndWatch(ConfigureHandler configureDelegate)
+ public static ISqlMapper ConfigureAndWatch(ConfigureHandler configureDelegate)
{
return ConfigureAndWatch( DomSqlMapBuilder.DEFAULT_FILE_CONFIG_NAME, configureDelegate ) ;
}
@@ -281,7 +281,7 @@
/// </param>
/// <returns>An SqlMap</returns>
[Obsolete("This method will be remove in future version, use DomSqlMapBuilder.Configure.", false)]
- public static SqlMapper ConfigureAndWatch( string resource, ConfigureHandler configureDelegate )
+ public static ISqlMapper ConfigureAndWatch(string resource, ConfigureHandler configureDelegate)
{
XmlDocument document = null;
if (resource.StartsWith("file://"))
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -38,6 +38,12 @@
internal class NullableInt64TypeHandler : BaseTypeHandler
{
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
{
Int64? nullableValue = (Int64?)parameterValue;
@@ -52,8 +58,9 @@
}
}
+
/// <summary>
- ///
+ /// Gets a column value by the name
/// </summary>
/// <param name="mapping"></param>
/// <param name="dataReader"></param>
@@ -72,6 +79,12 @@
}
}
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
{
if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
@@ -84,23 +97,45 @@
}
}
+ /// <summary>
+ /// Retrieve ouput database value
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used</param>
+ /// <returns></returns>
public override object GetDataBaseValue(object outputValue, Type parameterType)
{
return new Int64?(Convert.ToInt64(outputValue));
}
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
public override object ValueOf(Type type, string s)
{
return new Int64?(Int64.Parse(s));
}
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
public override bool IsSimpleType
{
get { return true; }
}
+ /// <summary>
+ /// The null value for this type
+ /// </summary>
+ /// <value></value>
public override object NullValue
{
get { return new Int64?(); }
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs?rev=417269&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -0,0 +1,148 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 378879 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#if dotnet2
+
+#region Using
+using System;
+using System.Data;
+
+using System.Collections.Generic;
+using IBatisNet.DataMapper.Configuration.ParameterMapping;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers.Nullables
+{
+ internal class NullableUInt16TypeHandler : BaseTypeHandler
+ {
+
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
+ public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
+ {
+ UInt16? nullableValue = (UInt16?)parameterValue;
+
+ if (nullableValue.HasValue)
+ {
+ dataParameter.Value = nullableValue.Value;
+ }
+ else
+ {
+ dataParameter.Value = DBNull.Value;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new UInt16?(Convert.ToUInt16(dataReader.GetValue(index)));
+ }
+ }
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new UInt16?(Convert.ToUInt16(dataReader.GetValue(mapping.ColumnIndex)));
+ }
+ }
+
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+ return new UInt16?(Convert.ToUInt16(outputValue));
+ }
+
+ public override object ValueOf(Type type, string s)
+ {
+ return new UInt16?(UInt16.Parse(s));
+ }
+
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+
+ /// <summary>
+ /// The null value for this type
+ /// </summary>
+ /// <value></value>
+ public override object NullValue
+ {
+ get { return new UInt16?(); }
+ }
+
+ //public override bool Equals(object x, object y)
+ //{
+ // //get boxed values.
+ // Int16? xTyped = (Int16?)x;
+ // return xTyped.Equals(y);
+ //}
+ }
+}
+
+#endif
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs?rev=417269&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -0,0 +1,122 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 378879 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#if dotnet2
+
+#region Using
+using System;
+using System.Data;
+
+using System.Collections.Generic;
+using IBatisNet.DataMapper.Configuration.ParameterMapping;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers.Nullables
+{
+ /// <summary>
+ /// Summary description for Int32TypeHandler.
+ /// </summary>
+ internal class NullableUInt32TypeHandler : BaseTypeHandler
+ {
+
+ public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
+ {
+ UInt32? nullableValue = (UInt32?)parameterValue;
+
+ if (nullableValue.HasValue)
+ {
+ dataParameter.Value = nullableValue.Value;
+ }
+ else
+ {
+ dataParameter.Value = DBNull.Value;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new UInt32?(Convert.ToUInt32(dataReader.GetValue(index)));
+ }
+ }
+
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new UInt32?(Convert.ToUInt32(dataReader.GetValue(mapping.ColumnIndex)));
+ }
+ }
+
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+ return new UInt32?(Convert.ToUInt32(outputValue));
+ }
+
+ public override object ValueOf(Type type, string s)
+ {
+ return new UInt32?(UInt32.Parse(s));
+ }
+
+
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+
+ public override object NullValue
+ {
+ get { return new UInt32?(); }
+ }
+
+ //public override bool Equals(object x, object y)
+ //{
+ // //get boxed values.
+ // Int32? xTyped = (Int32?)x;
+ // return xTyped.Equals(y);
+ //}
+ }
+}
+
+#endif
\ No newline at end of file
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs?rev=417269&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -0,0 +1,153 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 378879 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#if dotnet2
+#region Using
+using System;
+using System.Data;
+
+using System.Collections.Generic;
+using IBatisNet.DataMapper.Configuration.ParameterMapping;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers.Nullables
+{
+ internal class NullableUInt64TypeHandler : BaseTypeHandler
+ {
+
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
+ public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
+ {
+ UInt64? nullableValue = (UInt64?)parameterValue;
+
+ if (nullableValue.HasValue)
+ {
+ dataParameter.Value = nullableValue.Value;
+ }
+ else
+ {
+ dataParameter.Value = DBNull.Value;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new UInt64?(Convert.ToUInt64(dataReader.GetValue(index)));
+ }
+ }
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new UInt64?(Convert.ToUInt64(dataReader.GetValue(mapping.ColumnIndex)));
+ }
+ }
+
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+ return new UInt64?(Convert.ToUInt64(outputValue));
+ }
+
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
+ public override object ValueOf(Type type, string s)
+ {
+ return new UInt64?(UInt64.Parse(s));
+ }
+
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+
+ /// <summary>
+ /// The null value for this type
+ /// </summary>
+ /// <value></value>
+ public override object NullValue
+ {
+ get { return new UInt64?(); }
+ }
+
+ //public override bool Equals(object x, object y)
+ //{
+ // //get boxed values.
+ // Int64? xTyped = (Int64?)x;
+ // return xTyped.Equals(y);
+ //}
+ }
+}
+
+#endif
\ No newline at end of file
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs?rev=417269&r1=417268&r2=417269&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs Mon Jun 26 11:21:12 2006
@@ -117,6 +117,15 @@
handler = new EnumTypeHandler();
this.Register( typeof(System.Enum), handler);
+ handler = new UInt16TypeHandler();
+ this.Register(typeof(UInt16), handler);
+
+ handler = new UInt32TypeHandler();
+ this.Register(typeof(UInt32), handler);
+
+ handler = new UInt64TypeHandler();
+ this.Register(typeof(UInt64), handler);
+
#if dotnet2
handler = new NullableBooleanTypeHandler();
this.Register(typeof(bool?), handler);
@@ -150,6 +159,15 @@
handler = new NullableSingleTypeHandler();
this.Register(typeof(Single?), handler);
+
+ handler = new NullableUInt16TypeHandler();
+ this.Register(typeof(UInt16?), handler);
+
+ handler = new NullableUInt32TypeHandler();
+ this.Register(typeof(UInt32?), handler);
+
+ handler = new NullableUInt64TypeHandler();
+ this.Register(typeof(UInt64?), handler);
#endif
_unknownTypeHandler = new UnknownTypeHandler(this);
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs?rev=417269&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -0,0 +1,119 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 408164 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#region Using
+
+using System;
+using System.Data;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers
+{
+ internal sealed class UInt16TypeHandler : BaseTypeHandler
+ {
+
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ // Don't used dataReader.GetInt32 to fix oracle who alwray return decimal type
+ return Convert.ToUInt16(dataReader.GetValue(index));
+ }
+ }
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ // Don't used dataReader.GetInt32 to fix oracle who alwray return decimal type
+ return Convert.ToUInt16(dataReader.GetValue(mapping.ColumnIndex));
+ }
+ }
+
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+ return Convert.ToUInt16(outputValue);
+ }
+
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
+ public override object ValueOf(Type type, string s)
+ {
+ return Convert.ToUInt16(s);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+ //public override object NullValue
+ //{
+ // get { throw new InvalidCastException("Int16TypeHandler could not cast a null value in int16 field."); }
+ //}
+ }
+}
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs?rev=417269&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -0,0 +1,121 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 408164 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#region Using
+
+using System;
+using System.Data;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers
+{
+ /// <summary>
+ /// UInt32TypeHandler
+ /// </summary>
+ internal sealed class UInt32TypeHandler : BaseTypeHandler
+ {
+
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return Convert.ToUInt32(dataReader.GetValue(index));
+ }
+ }
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return Convert.ToUInt32(dataReader.GetValue(mapping.ColumnIndex));
+ }
+ }
+
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+ return Convert.ToUInt32(outputValue);
+ }
+
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
+ public override object ValueOf(Type type, string s)
+ {
+ return Convert.ToUInt32(s);
+ }
+
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+ //public override object NullValue
+ //{
+ // get { throw new InvalidCastException("Int32TypeHandler could not cast a null value in int32 field."); }
+ //}
+ }
+}
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs?rev=417269&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs Mon Jun 26 11:21:12 2006
@@ -0,0 +1,122 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 408164 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#region Using
+
+using System;
+using System.Data;
+using IBatisNet.DataMapper.Configuration.ParameterMapping;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+#endregion
+
+
+namespace IBatisNet.DataMapper.TypeHandlers
+{
+ /// <summary>
+ /// Summary description for UInt64TypeHandler.
+ /// </summary>
+ internal sealed class UInt64TypeHandler : BaseTypeHandler
+ {
+
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return System.DBNull.Value;
+ }
+ else
+ {
+ return Convert.ToUInt64(dataReader.GetValue(index));
+ }
+ }
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return System.DBNull.Value;
+ }
+ else
+ {
+ return Convert.ToUInt64(dataReader.GetValue(mapping.ColumnIndex));
+ }
+ }
+
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+ return Convert.ToUInt64(outputValue);
+ }
+
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
+ public override object ValueOf(Type type, string s)
+ {
+ return Convert.ToUInt64(s);
+ }
+
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+ //public override object NullValue
+ //{
+ // get { throw new InvalidCastException("Int64TypeHandler could not cast a null value in int64 field."); }
+ //}
+ }
+}
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy