Author: gbayon
Date: Sat Jul 23 07:04:03 2005
New Revision: 224468
URL: http://svn.apache.org/viewcvs?rev=224468&view=rev
Log:
- Fix for IBATISNET-97 for QueryForList and QueryForMap
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
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=224468&r1=224467&r2=224468&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
Sat Jul 23 07:04:03 2005
@@ -552,12 +552,29 @@
CacheKeyType.List);
}
- list = (IList)_statement.CacheModel[key];
- if (list == null)
+ object listAsObject =
_statement.CacheModel[key];
+ // check if this query has alreay been run
+ if (listAsObject == CacheModel.NULL_OBJECT)
+ {
+ // convert the marker object back into
a an empty list
+ if (_statement.ListClass == null)
+ {
+ list = new ArrayList();
+ }
+ else
+ {
+ list =
_statement.CreateInstanceOfListClass();
+ }
+ }
+ else if (listAsObject == null)
{
list = RunQueryForList(request,
session, parameterObject, skipResults, maxResults, null);
_statement.CacheModel[key] = list;
}
+ else
+ {
+ list = (IList) listAsObject;
+ }
}
return list;
@@ -818,11 +835,21 @@
CacheKeyType.Map);
}
- map = (IDictionary)_statement.CacheModel[key];
- if (map == null)
+ object mapAsObject =
(IDictionary)_statement.CacheModel[key];
+ // check if this query has alreay been run
+ if (mapAsObject == CacheModel.NULL_OBJECT)
+ {
+ // convert the marker object back into
a an empty hashtable
+ map = new Hashtable();
+ }
+ else if (mapAsObject == null)
{
map = RunQueryForMap( request, session,
parameterObject, keyProperty, valueProperty );
_statement.CacheModel[key] = map;
+ }
+ else
+ {
+ map = (IDictionary) mapAsObject;
}
}