PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Structures » Structures_DataGrid_DataSource_DBTable » Bug #8512

need 'params' in bind() options

Details

Request #8512need 'params' in bind() options
Submitted2006-08-19 13:58 UTC
Fromkenchou77 at gmail dot com
Assignedwiesemann
StatusClosed
PackageStructures_DataGrid_DataSource_DBTable
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2006-08-19 13:58 UTC] kenchou77 at gmail dot com

Description:
------------
when sql use placeholder,need params. DB_Table has this feature,but Structures_DataGrid_DataSource_DBTable ignore it.

change code: function &fetch() and function count()

1.function &fetch
if (!isset($this->_options['params'])
|| empty($this->_options['params'])) {
$this->_result = $this->_object->selectResult(
$this->_options['view'],
$this->_options['where'],
$sortString,
$offset, $limit);
}else {
$this->_result = $this->_object->selectResult(
$this->_options['view'],
$this->_options['where'],
$sortString,
$offset, $limit,
$this->_options['params']);
}

2.function count()

if (!isset($this->_options['params'])
|| empty($this->_options['params'])) {
return $this->_object->selectCount($this->_options['view'],
$this->_options['where']);
}else {
return $this->_object->selectCount($this->_options['view'],
$this->_options['where'],
NULL,
NULL,
NULL,
$this->_options['params']);
}

Test script:
---------------
example:

$filter = 'email=:email';
$params = array('email'=>'who@where.net');

$datagrid->bind($dataObject, array('view' =>'list', 'where' => $filter, 'params' => $params);