summaryrefslogtreecommitdiff
path: root/framework/Data/SqlMap
diff options
context:
space:
mode:
authormikl <>2008-07-31 13:07:13 +0000
committermikl <>2008-07-31 13:07:13 +0000
commit5cb8bf3a2d0f7d7b9b0b5907a80aee85a8c6f2d9 (patch)
treefbc702049cf4acf280836dea42774cd39a983f17 /framework/Data/SqlMap
parente69594d31e5968cb3663cb6748bf1682cd914b5a (diff)
Fixed #893: Added page parameter to queryForPagedList()
Diffstat (limited to 'framework/Data/SqlMap')
-rw-r--r--framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php10
-rw-r--r--framework/Data/SqlMap/TSqlMapGateway.php10
2 files changed, 12 insertions, 8 deletions
diff --git a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php
index a52e9a39..b3a88653 100644
--- a/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php
+++ b/framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php
@@ -41,12 +41,13 @@ class TSqlMapPagedList extends TPagedList
* @param mixed query parameters
* @param int page size
* @param mixed delegate for each data row retrieved.
+ * @param int number of page to fetch on initialization
*/
- public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null)
+ public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null, $page=0)
{
parent::__construct();
parent::setCustomPaging(true);
- $this->initialize($statement,$parameter, $pageSize);
+ $this->initialize($statement,$parameter, $pageSize, $page);
$this->_delegate=$delegate;
}
@@ -55,14 +56,15 @@ class TSqlMapPagedList extends TPagedList
* @param IMappedStatement SqlMap statement.
* @param mixed query parameters
* @param int page size.
+ * @param int number of page.
*/
- protected function initialize($statement, $parameter, $pageSize)
+ protected function initialize($statement, $parameter, $pageSize, $page)
{
$this->_statement = $statement;
$this->_parameter = $parameter;
$this->setPageSize($pageSize);
$this->attachEventHandler('OnFetchData', array($this, 'fetchDataFromStatement'));
- $this->gotoPage(0);
+ $this->gotoPage($page);
}
/**
diff --git a/framework/Data/SqlMap/TSqlMapGateway.php b/framework/Data/SqlMap/TSqlMapGateway.php
index fcd7d216..dd7c2069 100644
--- a/framework/Data/SqlMap/TSqlMapGateway.php
+++ b/framework/Data/SqlMap/TSqlMapGateway.php
@@ -122,12 +122,13 @@ class TSqlMapGateway extends TComponent
* @param string The name of the sql statement to execute.
* @param mixed The object used to set the parameters in the SQL.
* @param integer The maximum number of objects to store in each page.
+ * @param integer The number of the page to initially load into the list.
* @return TPagedList A PaginatedList of beans containing the rows.
*/
- public function queryForPagedList($statementName, $parameter=null, $pageSize=10)
+ public function queryForPagedList($statementName, $parameter=null, $pageSize=10, $page=0)
{
$statement = $this->getSqlMapManager()->getMappedStatement($statementName);
- return new TSqlMapPagedList($statement, $parameter, $pageSize);
+ return new TSqlMapPagedList($statement, $parameter, $pageSize, null, $page);
}
/**
@@ -142,12 +143,13 @@ class TSqlMapGateway extends TComponent
* @param callback Row delegate handler, a valid callback required.
* @param mixed The object used to set the parameters in the SQL.
* @param integer The maximum number of objects to store in each page.
+ * @param integer The number of the page to initially load into the list.
* @return TPagedList A PaginatedList of beans containing the rows.
*/
- public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10)
+ public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10, $page=0)
{
$statement = $this->getSqlMapManager()->getMappedStatement($statementName);
- return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate);
+ return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate,$page);
}