Author: gbayon
Date: Mon Jun 2 10:59:24 2008
New Revision: 662500
URL: http://svn.apache.org/viewvc?rev=662500&view=rev
Log:
Remove API for QueryForList with skipResults and maxResults
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/Generics/StatementTest.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/StatementTest.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataMapper.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/IDataMapper.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/DeleteMappedStatement.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/IMappedStatement.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/InsertMappedStatement.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/UpdateMappedStatement.cs
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/Generics/StatementTest.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/Generics/StatementTest.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/Generics/StatementTest.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/Generics/StatementTest.cs
Mon Jun 2 10:59:24 2008
@@ -469,19 +469,6 @@
Assert.AreEqual("[EMAIL PROTECTED]", list[4]);
}
- /// <summary>
- /// Test QueryForListWithSkipAndMax
- /// </summary>
- [Test]
- public void TestQueryForListWithSkipAndMax()
- {
- IList<Account> list =
dataMapper.QueryForList<Account>("GetAllAccountsViaResultMap", null, 2, 2);
-
- Assert.AreEqual(2, list.Count);
- Assert.AreEqual(3, list[0].Id);
- Assert.AreEqual(4, list[1].Id);
- }
-
[Test]
public void TestQueryWithRowDelegate()
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/StatementTest.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/StatementTest.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/StatementTest.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/Mapping/StatementTest.cs
Mon Jun 2 10:59:24 2008
@@ -448,19 +448,6 @@
Assert.AreEqual("[EMAIL PROTECTED]", (string)list[4]);
}
- /// <summary>
- /// Test QueryForListWithSkipAndMax
- /// </summary>
- [Test]
- public void TestQueryForListWithSkipAndMax()
- {
- IList list = dataMapper.QueryForList("GetAllAccountsViaResultMap",
null, 2, 2);
-
- Assert.AreEqual(2, list.Count);
- Assert.AreEqual(3, ((Account)list[0]).Id);
- Assert.AreEqual(4, ((Account)list[1]).Id);
- }
-
[Test]
public void TestQueryWithRowDelegate()
Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataMapper.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataMapper.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataMapper.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/DataMapper.cs Mon Jun 2
10:59:24 2008
@@ -162,25 +162,6 @@
}
}
- /// <summary>
- /// Executes the SQL and retuns all rows selected.
- /// <p/>
- /// The parameter object is generally used to supply the input
- /// data for the WHERE clause parameter(s) of the SELECT statement.
- /// </summary>
- /// <param name="statementId">The statement id.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- public IList QueryForList(string statementId, object parameterObject,
int skipResults, int maxResults)
- {
- using (DataMapperLocalSessionScope sessionScope = new
DataMapperLocalSessionScope(sessionStore, sessionFactory))
- {
- IMappedStatement statement =
modelStore.GetMappedStatement(statementId);
- return statement.ExecuteQueryForList(sessionScope.Session,
parameterObject, skipResults, maxResults);
- }
- }
/// <summary>
/// Executes the SQL and retuns all rows selected in a map that is
keyed on the property named
@@ -480,26 +461,6 @@
}
}
- /// <summary>
- /// Executes the SQL and retuns all rows selected.
- /// <p/>
- /// The parameter object is generally used to supply the input
- /// data for the WHERE clause parameter(s) of the SELECT statement.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="statementId">The statement id.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- public IList<T> QueryForList<T>(string statementId, object
parameterObject, int skipResults, int maxResults)
- {
- using (DataMapperLocalSessionScope sessionScope = new
DataMapperLocalSessionScope(sessionStore, sessionFactory))
- {
- IMappedStatement statement =
modelStore.GetMappedStatement(statementId);
- return statement.ExecuteQueryForList<T>(sessionScope.Session,
parameterObject, skipResults, maxResults);
- }
- }
/// <summary>
/// Runs a query for list with a custom object that gets a chance to
deal
@@ -559,7 +520,6 @@
private class DataMapperLocalSessionScope : IDisposable
{
private readonly bool isSessionLocal = false;
- private readonly ISessionStore sessionStore =null;
private readonly ISession session = null;
/// <summary>
Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/IDataMapper.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/IDataMapper.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/IDataMapper.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/IDataMapper.cs Mon Jun 2
10:59:24 2008
@@ -110,20 +110,6 @@
IList QueryForList(string statementName, object parameterObject);
/// <summary>
- /// Executes the SQL and retuns all rows selected.
- /// <p/>
- /// The parameter object is generally used to supply the input
- /// data for the WHERE clause parameter(s) of the SELECT statement.
- /// </summary>
- /// <param name="statementName">The name of the sql statement to
execute.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- IList QueryForList(string statementName, object parameterObject, int
skipResults, int maxResults);
-
-
- /// <summary>
/// Executes the SQL and retuns all rows selected in a map that is
keyed on the property named
/// in the keyProperty parameter. The value at each key will be the
entire result object.
/// </summary>
@@ -298,19 +284,6 @@
void QueryForList<T>(string statementName, object parameterObject,
IList<T> resultObject);
/// <summary>
- /// Executes the SQL and retuns all rows selected.
- /// <p/>
- /// The parameter object is generally used to supply the input
- /// data for the WHERE clause parameter(s) of the SELECT statement.
- /// </summary>
- /// <param name="statementName">The name of the sql statement to
execute.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- IList<T> QueryForList<T>(string statementName, object parameterObject,
int skipResults, int maxResults);
-
- /// <summary>
/// Runs a query for list with a custom object that gets a chance to
deal
/// with each row as it is processed.
/// <p/>
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/CachingStatement.cs
Mon Jun 2 10:59:24 2008
@@ -231,45 +231,30 @@
_mappedStatement.ExecuteQueryForList(session,
parameterObject, resultObject);
}
- /// <summary>
- /// Executes the SQL and retuns a subset of the rows selected.
- /// </summary>
- /// <param name="session">The session used to execute the
statement.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip
over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- public IList ExecuteQueryForList(ISession session, object
parameterObject, int skipResults, int maxResults)
- {
- IList list = null;
- RequestScope request =
this.Statement.Sql.GetRequestScope(this, parameterObject, session);
-
- _mappedStatement.PreparedCommand.Create( request,
session, this.Statement, parameterObject );
-
- CacheKey cacheKey = this.GetCacheKey(request);
- cacheKey.Update("ExecuteQueryForList");
- cacheKey.Update(skipResults);
- cacheKey.Update(maxResults);
-
- list = this.Statement.CacheModel[cacheKey] as IList;
- if (list == null)
- {
- list =
_mappedStatement.RunQueryForList(request, session, parameterObject,
skipResults, maxResults);
- this.Statement.CacheModel[cacheKey] = list;
- }
-
- return list;
- }
/// <summary>
- /// Executes the SQL and retuns all rows selected. This is exactly the
same as
- /// calling ExecuteQueryForList(session, parameterObject,
NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS).
+ /// Executes the SQL and retuns all rows selected.
/// </summary>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
/// <returns>A List of result objects.</returns>
public IList ExecuteQueryForList(ISession session, object
parameterObject)
{
- return this.ExecuteQueryForList(session, parameterObject,
MappedStatement.NO_SKIPPED_RESULTS, MappedStatement.NO_MAXIMUM_RESULTS);
+ IList list = null;
+ RequestScope request = this.Statement.Sql.GetRequestScope(this,
parameterObject, session);
+
+ _mappedStatement.PreparedCommand.Create(request, session,
this.Statement, parameterObject);
+
+ CacheKey cacheKey = this.GetCacheKey(request);
+ cacheKey.Update("ExecuteQueryForList");
+
+ list = this.Statement.CacheModel[cacheKey] as IList;
+ if (list == null)
+ {
+ list = _mappedStatement.RunQueryForList(request, session,
parameterObject);
+ this.Statement.CacheModel[cacheKey] = list;
+ }
+
+ return list;
}
#endregion
@@ -287,14 +272,12 @@
}
/// <summary>
- /// Executes the SQL and retuns a subset of the rows selected.
+ /// Executes the SQL and retuns all rows selected.
/// </summary>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
/// <returns>A List of result objects.</returns>
- public IList<T> ExecuteQueryForList<T>(ISession session, object
parameterObject, int skipResults, int maxResults)
+ public IList<T> ExecuteQueryForList<T>(ISession session, object
parameterObject)
{
IList<T> list = null;
RequestScope request = this.Statement.Sql.GetRequestScope(this,
parameterObject, session);
@@ -303,29 +286,16 @@
CacheKey cacheKey = this.GetCacheKey(request);
cacheKey.Update("ExecuteQueryForList");
- cacheKey.Update(skipResults);
- cacheKey.Update(maxResults);
list = this.Statement.CacheModel[cacheKey] as IList<T>;
if (list == null)
{
- list = _mappedStatement.RunQueryForList<T>(request, session,
parameterObject, skipResults, maxResults);
+ list = _mappedStatement.RunQueryForList<T>(request, session,
parameterObject);
this.Statement.CacheModel[cacheKey] = list;
}
return list;
}
- /// <summary>
- /// Executes the SQL and retuns all rows selected. This is exactly the
same as
- /// calling ExecuteQueryForList(session, parameterObject,
NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS).
- /// </summary>
- /// <param name="session">The session used to execute the
statement.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <returns>A List of result objects.</returns>
- public IList<T> ExecuteQueryForList<T>(ISession session, object
parameterObject)
- {
- return this.ExecuteQueryForList<T>(session, parameterObject,
MappedStatement.NO_SKIPPED_RESULTS, MappedStatement.NO_MAXIMUM_RESULTS);
- }
#endregion
#region ExecuteQueryForObject
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/DeleteMappedStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/DeleteMappedStatement.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/DeleteMappedStatement.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/DeleteMappedStatement.cs
Mon Jun 2 10:59:24 2008
@@ -93,18 +93,6 @@
throw new DataMapperException("Delete statements cannot
be executed as a query for list.");
}
- /// <summary>
- ///
- /// </summary>
- /// <param name="session"></param>
- /// <param name="parameterObject"></param>
- /// <param name="skipResults"></param>
- /// <param name="maxResults"></param>
- /// <returns></returns>
- public override IList ExecuteQueryForList(ISession session, object
parameterObject, int skipResults, int maxResults)
- {
- throw new DataMapperException("Delete statements cannot
be executed as a query for list.");
- }
/// <summary>
///
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/IMappedStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/IMappedStatement.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/IMappedStatement.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/IMappedStatement.cs
Mon Jun 2 10:59:24 2008
@@ -166,18 +166,7 @@
void ExecuteQueryForList(ISession session, object
parameterObject, IList resultObject );
/// <summary>
- /// Executes the SQL and retuns a subset of the rows selected.
- /// </summary>
- /// <param name="session">The session used to execute the
statement.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip
over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- IList ExecuteQueryForList( ISession session, object
parameterObject, int skipResults, int maxResults );
-
- /// <summary>
- /// Executes the SQL and retuns all rows selected. This is
exactly the same as
- /// calling ExecuteQueryForList(session, parameterObject,
NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS).
+ /// Executes the SQL and retuns all rows selected.
/// </summary>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
@@ -196,18 +185,7 @@
void ExecuteQueryForList<T>(ISession session, object parameterObject,
IList<T> resultObject);
/// <summary>
- /// Executes the SQL and retuns a subset of the rows selected.
- /// </summary>
- /// <param name="session">The session used to execute the
statement.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- IList<T> ExecuteQueryForList<T>(ISession session, object
parameterObject, int skipResults, int maxResults);
-
- /// <summary>
- /// Executes the SQL and retuns all rows selected. This is exactly the
same as
- /// calling ExecuteQueryForList(session, parameterObject,
NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS).
+ /// Executes the SQL and retuns all rows selected.
/// </summary>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/InsertMappedStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/InsertMappedStatement.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/InsertMappedStatement.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/InsertMappedStatement.cs
Mon Jun 2 10:59:24 2008
@@ -97,19 +97,6 @@
/// </summary>
/// <param name="session"></param>
/// <param name="parameterObject"></param>
- /// <param name="skipResults"></param>
- /// <param name="maxResults"></param>
- /// <returns></returns>
- public override IList ExecuteQueryForList(ISession session,
object parameterObject, int skipResults, int maxResults )
- {
- throw new DataMapperException("Insert statements cannot
be executed as a query for list.");
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="session"></param>
- /// <param name="parameterObject"></param>
/// <returns></returns>
public override IList ExecuteQueryForList(ISession session,
object parameterObject )
{
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/MappedStatement.cs
Mon Jun 2 10:59:24 2008
@@ -57,17 +57,11 @@
public class MappedStatement : IMappedStatement
{
/// <summary>
- /// Event launch on exceute query
+ /// Event launch on execute query
/// </summary>
public event ExecuteEventHandler Execute = delegate {};
#region Fields
-
- // Magic number used to set the the maximum number of rows returned to
'all'.
- public const int NO_MAXIMUM_RESULTS = -1;
- // Magic number used to set the the number of rows skipped to 'none'.
- public const int NO_SKIPPED_RESULTS = -1;
-
private readonly IStatement statement = null;
private readonly IModelStore modelStore = null;
private readonly IPreparedCommand preparedCommand = null;
@@ -279,7 +273,7 @@
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
#region remark
// If you are using the OleDb data provider (as you are), you
need to close the
@@ -368,7 +362,7 @@
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
#region remark
// If you are using the OleDb data provider, you need to close
the
@@ -435,8 +429,7 @@
/// <summary>
- /// Executes the SQL and retuns all rows selected. This is exactly the
same as
- /// calling ExecuteQueryForList(session, parameterObject,
NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS).
+ /// Executes the SQL and retuns all rows selected.
/// </summary>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
@@ -447,37 +440,18 @@
preparedCommand.Create(request, session, this.Statement,
parameterObject);
- return RunQueryForList(request, session, parameterObject, null,
null);
+ return RunQueryForList(request, session, parameterObject);
}
/// <summary>
- /// Executes the SQL and retuns a subset of the rows selected.
- /// </summary>
- /// <param name="session">The session used to execute the
statement.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- public virtual IList ExecuteQueryForList(ISession session, object
parameterObject, int skipResults, int maxResults)
- {
- RequestScope request = statement.Sql.GetRequestScope(this,
parameterObject, session);
-
- preparedCommand.Create(request, session, this.Statement,
parameterObject);
-
- return RunQueryForList(request, session, parameterObject,
skipResults, maxResults);
- }
-
- /// <summary>
/// Runs the query for list.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
/// <returns>A List of result objects.</returns>
- internal IList RunQueryForList(RequestScope request, ISession session,
object parameterObject, int skipResults, int maxResults)
+ internal IList RunQueryForList(RequestScope request, ISession session,
object parameterObject)
{
IList list = null;
@@ -496,27 +470,19 @@
try
{
- // skip results
- for (int i = 0; i < skipResults; i++)
- {
- if (!reader.Read())
- {
- break;
- }
- }
-
- // Get Results
- int resultsFetched = 0;
- while ((maxResults == NO_MAXIMUM_RESULTS || resultsFetched
< maxResults)
- && reader.Read())
- {
- object obj = resultStrategy.Process(request, ref
reader, null);
- if (obj != BaseStrategy.SKIP)
- {
- list.Add(obj);
- }
- resultsFetched++;
- }
+ do
+ {
+ // Get Results
+ while (reader.Read())
+ {
+ object obj = resultStrategy.Process(request, ref
reader, null);
+ if (obj != BaseStrategy.SKIP)
+ {
+ list.Add(obj);
+ }
+ }
+ }
+ while (reader.NextResult());
}
catch
{
@@ -528,7 +494,7 @@
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
RetrieveOutputParameters(request, session, command,
parameterObject);
}
@@ -601,7 +567,7 @@
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
RetrieveOutputParameters(request, session, command,
parameterObject);
}
@@ -651,8 +617,7 @@
/// <summary>
- /// Executes the SQL and retuns all rows selected. This is exactly the
same as
- /// calling ExecuteQueryForList(session, parameterObject,
NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS).
+ /// Executes the SQL and retuns all rows selected.
/// </summary>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
@@ -666,35 +631,14 @@
return RunQueryForList<T>(request, session, parameterObject, null,
null);
}
-
- /// <summary>
- /// Executes the SQL and retuns a subset of the rows selected.
- /// </summary>
- /// <param name="session">The session used to execute the
statement.</param>
- /// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
- /// <returns>A List of result objects.</returns>
- public virtual IList<T> ExecuteQueryForList<T>(ISession session,
object parameterObject, int skipResults, int maxResults)
- {
- RequestScope request = statement.Sql.GetRequestScope(this,
parameterObject, session);
-
- preparedCommand.Create(request, session, this.Statement,
parameterObject);
-
- return RunQueryForList<T>(request, session, parameterObject,
skipResults, maxResults);
- }
-
-
/// <summary>
/// Executes the SQL and retuns a List of result objects.
/// </summary>
/// <param name="request">The request scope.</param>
/// <param name="session">The session used to execute the
statement.</param>
/// <param name="parameterObject">The object used to set the
parameters in the SQL.</param>
- /// <param name="skipResults">The number of rows to skip over.</param>
- /// <param name="maxResults">The maximum number of rows to
return.</param>
/// <returns>A List of result objects.</returns>
- internal IList<T> RunQueryForList<T>(RequestScope request, ISession
session, object parameterObject, int skipResults, int maxResults)
+ internal IList<T> RunQueryForList<T>(RequestScope request, ISession
session, object parameterObject)
{
IList<T> list = null;
@@ -712,26 +656,18 @@
IDataReader reader = command.ExecuteReader();
try
{
- // skip results
- for (int i = 0; i < skipResults; i++)
- {
- if (!reader.Read())
- {
- break;
- }
- }
-
- int resultsFetched = 0;
- while ((maxResults == NO_MAXIMUM_RESULTS || resultsFetched
< maxResults)
- && reader.Read())
+ do
{
- object obj = resultStrategy.Process(request, ref
reader, null);
- if (obj != BaseStrategy.SKIP)
+ while (reader.Read())
{
- list.Add((T)obj);
+ object obj = resultStrategy.Process(request, ref
reader, null);
+ if (obj != BaseStrategy.SKIP)
+ {
+ list.Add((T) obj);
+ }
}
- resultsFetched++;
}
+ while (reader.NextResult());
}
catch
{
@@ -743,7 +679,7 @@
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
RetrieveOutputParameters(request, session, command,
parameterObject);
}
@@ -816,7 +752,7 @@
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
RetrieveOutputParameters(request, session, command,
parameterObject);
}
@@ -861,8 +797,6 @@
{
rows = command.ExecuteNonQuery();
- //ExecutePostSelect(request);
-
RetrieveOutputParameters(request, session, command,
parameterObject);
}
@@ -942,8 +876,6 @@
request.DataExchangeFactory.AccessorFactory);
}
- //ExecutePostSelect(request);
-
RetrieveOutputParameters(request, session, command,
parameterObject);
}
@@ -1044,7 +976,7 @@
reader.Close();
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
}
return map;
@@ -1170,7 +1102,7 @@
reader.Close();
reader.Dispose();
}
- ExecutePostSelect(request);
+ ExecuteDeferredLoad(request);
}
return map;
@@ -1183,11 +1115,11 @@
/// Executes the <see cref="PostBindind"/>.
/// </summary>
/// <param name="request">The current <see
cref="RequestScope"/>.</param>
- private void ExecutePostSelect(RequestScope request)
+ private void ExecuteDeferredLoad(RequestScope request)
{
- while (request.QueueSelect.Count > 0)
+ while (request.DeferredLoad.Count > 0)
{
- PostBindind postSelect = request.QueueSelect.Dequeue() as
PostBindind;
+ PostBindind postSelect = request.DeferredLoad.Dequeue();
PostSelectStrategyFactory.Get(postSelect.Method).Execute(postSelect, request);
}
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
Mon Jun 2 10:59:24 2008
@@ -66,7 +66,7 @@
throw new NotImplementedException("Lazy load no
supported for System.Array property:" + mapping.SetAccessor.Name);
}
postSelect.Method =
PostBindind.ExecuteMethod.ExecuteQueryForArrayList;
- request.QueueSelect.Enqueue(postSelect);
+ request.DeferredLoad.Enqueue(postSelect);
}
/// <summary>
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
Mon Jun 2 10:59:24 2008
@@ -75,7 +75,7 @@
{
postSelect.Method =
PostBindind.ExecuteMethod.ExecuteQueryForGenericIList;
}
- request.QueueSelect.Enqueue(postSelect);
+ request.DeferredLoad.Enqueue(postSelect);
}
}
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
Mon Jun 2 10:59:24 2008
@@ -79,7 +79,7 @@
{
postSelect.Method =
PostBindind.ExecuteMethod.ExecuteQueryForStrongTypedIList;
}
- request.QueueSelect.Enqueue(postSelect);
+ request.DeferredLoad.Enqueue(postSelect);
}
}
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
Mon Jun 2 10:59:24 2008
@@ -74,7 +74,7 @@
else
{
postSelect.Method =
PostBindind.ExecuteMethod.ExecuteQueryForObject;
- request.QueueSelect.Enqueue(postSelect);
+ request.DeferredLoad.Enqueue(postSelect);
}
}
Modified:
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/UpdateMappedStatement.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/UpdateMappedStatement.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
---
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/UpdateMappedStatement.cs
(original)
+++
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/UpdateMappedStatement.cs
Mon Jun 2 10:59:24 2008
@@ -93,18 +93,6 @@
throw new DataMapperException("Update statements cannot
be executed as a query for list.");
}
- /// <summary>
- ///
- /// </summary>
- /// <param name="session"></param>
- /// <param name="parameterObject"></param>
- /// <param name="skipResults"></param>
- /// <param name="maxResults"></param>
- /// <returns></returns>
- public override IList ExecuteQueryForList(ISession session, object
parameterObject, int skipResults, int maxResults)
- {
- throw new DataMapperException("Update statements cannot
be executed as a query for list.");
- }
/// <summary>
///
Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs
URL:
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs?rev=662500&r1=662499&r2=662500&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs Mon
Jun 2 10:59:24 2008
@@ -53,7 +53,7 @@
private ParameterMap parameterMap = null;
private PreparedStatement preparedStatement = null;
private IDbCommand command = null;
- private Queue selects = new Queue();
+ private Queue<PostBindind> selects = new Queue<PostBindind>();
private bool rowDataFound = false;
private static long nextId = 0;
private readonly long id = 0;
@@ -185,7 +185,7 @@
/// <summary>
/// The 'select' result property to process after having process the
main properties.
/// </summary>
- public Queue QueueSelect
+ public Queue<PostBindind> DeferredLoad
{
get { return selects; }
set { selects = value; }