Author: gbayon
Date: Fri Nov 11 03:20:17 2005
New Revision: 332519
URL: http://svn.apache.org/viewcvs?rev=332519&view=rev
Log:
Fixed IBATISNET-125
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Account.xml
Fri Nov 11 03:20:17 2005
@@ -59,6 +59,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<select id="GetAccountsDynamic" resultMap="account-result"
parameterClass="Hashtable" >
select top $MaximumAllowed$ * from Accounts
<dynamic prepend="where">
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Account.xml
Fri Nov 11 03:20:17 2005
@@ -65,6 +65,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<select id="GetAccountsDynamic" resultMap="account-result"
parameterClass="Hashtable" >
select top $MaximumAllowed$ * from Accounts
<dynamic prepend="where">
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Account.xml
Fri Nov 11 03:20:17 2005
@@ -65,6 +65,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<select id="GetAccountsDynamic" resultMap="account-result"
parameterClass="Hashtable" >
select top $MaximumAllowed$ * from Accounts
<dynamic prepend="where">
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
Fri Nov 11 03:20:17 2005
@@ -190,6 +190,17 @@
from Accounts
order by Account_ID
</select>
+
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
<select id="GetAccountViaColumnName"
parameterClass="int"
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Account.xml
Fri Nov 11 03:20:17 2005
@@ -110,6 +110,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<select id="GetAccountsDynamic" resultMap="account-result"
parameterClass="Hashtable" >
select * from Accounts
<dynamic prepend="where">
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Account.xml
Fri Nov 11 03:20:17 2005
@@ -110,6 +110,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<select id="GetAccountsDynamic" resultMap="account-result"
parameterClass="Hashtable" >
select * from Accounts
<dynamic prepend="where">
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Account.xml
Fri Nov 11 03:20:17 2005
@@ -111,6 +111,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<!--
NOTE: Should NOT be a dynamic prepend test for Oracle since the
rownum has to be
part of the where clause. Best suited for MSSQL using TOP
keyword in SELECT.
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Account.xml
Fri Nov 11 03:20:17 2005
@@ -108,6 +108,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<!--
NOTE: Should NOT be a dynamic prepend test for Oracle since the
rownum has to be
part of the where clause. Best suited for MSSQL using TOP
keyword in SELECT.
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Account.xml
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Account.xml?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Account.xml
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Account.xml
Fri Nov 11 03:20:17 2005
@@ -110,6 +110,17 @@
-->
<statements>
+ <select id="GetAllAccountsAsArrayListViaResultClass"
+ resultClass="ArrayList">
+ select
+ Account_ID as Id,
+ Account_FirstName as FirstName,
+ Account_LastName as LastName,
+ Account_Email as EmailAddress
+ from Accounts
+ order by Account_ID
+ </select>
+
<select id="GetAccountsDynamic" resultMap="account-result"
parameterClass="Hashtable" >
select * from Accounts
<dynamic prepend="where">
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=332519&r1=332518&r2=332519&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 03:20:17 2005
@@ -303,6 +303,34 @@
}
/// <summary>
+ /// Test QueryForList with IList ResultClass
+ /// </summary>
+ [Test]
+ public void TestQueryForListWithIListResultClass()
+ {
+ IList list =
sqlMap.QueryForList("GetAllAccountsAsArrayListViaResultClass", null);
+
+ IList listAccount = (IList) list[0];
+ Assert.AreEqual(1,listAccount[0]);
+ Assert.AreEqual("Joe",listAccount[1]);
+ Assert.AreEqual("Dalton",listAccount[2]);
+ Assert.AreEqual("[EMAIL PROTECTED]",listAccount[3]);
+
+ Assert.AreEqual(5, list.Count);
+
+ listAccount = (IList) list[0];
+ Assert.AreEqual(1, listAccount[0]);
+ listAccount = (IList) list[1];
+ Assert.AreEqual(2, listAccount[0]);
+ listAccount = (IList) list[2];
+ Assert.AreEqual(3,listAccount[0]);
+ listAccount = (IList) list[3];
+ Assert.AreEqual(4, listAccount[0]);
+ listAccount = (IList) list[4];
+ Assert.AreEqual(5, listAccount[0]);
+ }
+
+ /// <summary>
/// Test QueryForList With ResultMap, result collection as
ArrayList
/// </summary>
[Test]
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs?rev=332519&r1=332518&r2=332519&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
Fri Nov 11 03:20:17 2005
@@ -283,12 +283,19 @@
SetObjectProperty(request,
request.ResultMap, property, ref outObject, reader);
}
- else if (outObject is Hashtable)
+ else if (outObject is IDictionary)
{
for (int i = 0; i <
reader.FieldCount; i++)
{
string columnName =
reader.GetName(i);
- ((Hashtable)
outObject).Add(columnName, reader.GetValue(i));
+ ((IDictionary)
outObject).Add(columnName, reader.GetValue(i));
+ }
+ }
+ else if (outObject is IList)
+ {
+ for (int i = 0; i <
reader.FieldCount; i++)
+ {
+ ((IList)
outObject).Add(reader.GetValue(i));
}
}
else