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/01/10 20:08:12 UTC

svn commit: r367738 - in /ibatis/trunk/cs/mapper: IBatisNet.DataMapper.Test/Maps/Access/OleDb/ IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/ IBatisNet.DataMapper.T...

Author: gbayon
Date: Tue Jan 10 11:07:44 2006
New Revision: 367738

URL: http://svn.apache.org/viewcvs?rev=367738&view=rev
Log:
- Fixed IBATISNET-138

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/CacheTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -58,7 +58,14 @@
     ============================================= 
     -->
 	<statements>
-
+	
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+			
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			select

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -145,6 +145,13 @@
 			where Account_ID = #value#
 		</select>
   
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+		
 		<select id="GetAllAccountsAsHashtableViaResultClass"
 						resultClass="Hashtable">
 			select

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -65,6 +65,13 @@
     -->
 	<statements>
 
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+		
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			select

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -245,6 +245,13 @@
 			order by Account_ID
 		</select>
 		
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+		
 		<select id="GetFewAccountsViaResultMap"
 			resultMap="account-result">
 			<![CDATA[

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -110,6 +110,13 @@
     -->
 	<statements>
 	
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+			
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			select

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -110,6 +110,13 @@
     -->
 	<statements>
 	
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+			
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			select

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -111,6 +111,13 @@
     -->
 	<statements>
 	
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+			
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -108,6 +108,13 @@
     -->
 	<statements>
 	
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+				
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -110,6 +110,13 @@
     -->
 	<statements>
 	
+		<select id="GetAllAccountsCache" 
+			resultMap="account-result"
+			cacheModel="account-cache">
+			select * from Accounts
+			order by Account_ID
+		</select>
+				
 		<select id="GetAllAccountsAsArrayListViaResultClass"
 						resultClass="ArrayList">
 			select

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs?rev=367738&r1=367737&r2=367738&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheTest.cs Tue Jan 10 11:07:44 2006
@@ -62,14 +62,12 @@
 			IList list = sqlMap.QueryForList("GetCachedAccountsViaResultMap", null);
 
 			int firstId = HashCodeProvider.GetIdentityHashCode(list);
-				//System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(list);
 
 			list = sqlMap.QueryForList("GetCachedAccountsViaResultMap", null);
 
 			//Console.WriteLine(sqlMap.GetDataCacheStats());
 
 			int secondId = HashCodeProvider.GetIdentityHashCode(list);
-				//System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(list);
 
 			Assert.AreEqual(firstId, secondId);
 

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=367738&r1=367737&r2=367738&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 Tue Jan 10 11:07:44 2006
@@ -652,6 +652,32 @@
 		}
 
 		/// <summary>
+		/// Test ExecuteQueryForMap With Cache : Hashtable.
+		/// </summary>
+		[Test]
+		public void TestExecuteQueryForMapWithCache()
+		{
+			IDictionary map = sqlMap.QueryForMap("GetAllAccountsCache", null, "FirstName");
+
+			int firstId = HashCodeProvider.GetIdentityHashCode(map);
+
+			Assert.AreEqual(5, map.Count);
+			AssertAccount1(((Account) map["Joe"]));
+
+			Assert.AreEqual(1, ((Account) map["Joe"]).Id);
+			Assert.AreEqual(2, ((Account) map["Averel"]).Id);
+			Assert.AreEqual(3, ((Account) map["William"]).Id);
+			Assert.AreEqual(4, ((Account) map["Jack"]).Id);
+			Assert.AreEqual(5, ((Account) map["Gilles"]).Id);
+
+			map = sqlMap.QueryForMap("GetAllAccountsCache", null, "FirstName");
+
+			int secondId = HashCodeProvider.GetIdentityHashCode(map);
+
+			Assert.AreEqual(firstId, secondId);
+		}
+
+		/// <summary>
 		/// Test ExecuteQueryForMap : Hashtable.
 		/// </summary>
 		/// <remarks>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs?rev=367738&r1=367737&r2=367738&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/CachingStatement.cs Tue Jan 10 11:07:44 2006
@@ -113,8 +113,14 @@
 
 			CacheKey cacheKey = this.GetCacheKey(request);
 			cacheKey.Update("ExecuteQueryForMap");
-			cacheKey.Update(keyProperty);
-			cacheKey.Update(valueProperty);
+			if (keyProperty!=null)
+			{
+				cacheKey.Update(keyProperty);
+			}
+			if (valueProperty!=null)
+			{
+				cacheKey.Update(valueProperty);
+			}
 
 			map = this.Statement.CacheModel[cacheKey] as IDictionary;
 			if (map == null) 

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=367738&r1=367737&r2=367738&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs Tue Jan 10 11:07:44 2006
@@ -802,7 +802,7 @@
 			object parameterObject, 
 			string keyProperty, 
 			string valueProperty, 
-		                                     SqlMapper.DictionaryRowDelegate rowDelegate  )
+		    SqlMapper.DictionaryRowDelegate rowDelegate  )
 		{
 			IDictionary map = new Hashtable();