cvs: pear /Structures_DataGrid package2-ds-dataobject.xml /Structures_DataGrid/DataGrid/DataSource DataObject.php
| From: | Olivier Guilyardi | Date: | Fri, 09 Feb 2007 11:54:17 +0000 |
| Subject: | cvs: pear /Structures_DataGrid package2-ds-dataobject.xml /Structures_DataGrid/DataGrid/DataSource DataObject.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44587@lists.php.net to get a copy of this message | ||
olivierg Fri Feb 9 11:54:17 2007 UTC
Modified files:
/pear/Structures_DataGrid package2-ds-dataobject.xml
/pear/Structures_DataGrid/DataGrid/DataSource DataObject.php
Log:
Bug #8106: optimized data fetching loop + cleanup
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/package2-ds-dataobject.xml?r1=1.6&r2=1.7&diff_format=u
Index: pear/Structures_DataGrid/package2-ds-dataobject.xml
diff -u pear/Structures_DataGrid/package2-ds-dataobject.xml:1.6
pear/Structures_DataGrid/package2-ds-dataobject.xml:1.7
--- pear/Structures_DataGrid/package2-ds-dataobject.xml:1.6 Sat Dec 16 15:54:43 2006
+++ pear/Structures_DataGrid/package2-ds-dataobject.xml Fri Feb 9 11:54:17 2007
@@ -20,10 +20,10 @@
<email>olivier@samalyse.com</email>
<active>yes</active>
</lead>
- <date>2006-12-16</date>
- <time>17:00:00</time>
+ <date>?</date>
+ <time>?</time>
<version>
- <release>0.1.1</release>
+ <release>0.1.2</release>
<api>0.1.0</api>
</version>
<stability>
@@ -32,9 +32,8 @@
</stability>
<license uri="http://opensource.org/licenses/bsd-license.php">New
BSD</license>
<notes>
-- Bug #9147: quote field names for sorting
- (thanks to Chris van de Wouw, chrisje at home dot nl)
-- this package is now licensed under the New BSD license
+- Bug #8106: optimized data fetching loop
+ (thanks to Michel D'HOOGE, michel dot dhooge at gmail dot com)
</notes>
<contents>
<dir name="/">
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php?r1=1.39&r2=1.40&diff_format=u
Index: pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php
diff -u pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php:1.39
pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php:1.40
--- pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php:1.39 Mon Jan 1 10:31:18 2007
+++ pear/Structures_DataGrid/DataGrid/DataSource/DataObject.php Fri Feb 9 11:54:17 2007
@@ -35,9 +35,9 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * CSV file id: $Id: DataObject.php,v 1.39 2007/01/01 10:31:18 wiesemann Exp $
+ * CSV file id: $Id: DataObject.php,v 1.40 2007/02/09 11:54:17 olivierg Exp $
*
- * @version $Revision: 1.39 $
+ * @version $Revision: 1.40 $
* @package Structures_DataGrid_DataSource_DataObject
* @category Structures
* @license http://opensource.org/licenses/bsd-license.php
New BSD License
@@ -64,7 +64,7 @@
* 'fields' option. If the 'fields' option is
set,
* this one will not be used.
*
- * @version $Revision: 1.39 $
+ * @version $Revision: 1.40 $
* @author Olivier Guilyardi <olivier@samalyse.com>
* @author Andrew Nagy <asnagy@webitecture.org>
* @access public
@@ -229,24 +229,25 @@
if ($this->_options['formbuilder_integration']) {
require_once('DB/DataObject/FormBuilder.php');
$links = $this->_dataobject->links();
- }
+ }
+ $initial = true;
while ($this->_dataobject->fetch()) {
// Determine Fields
- if (!$this->_options['fields']) {
- if ($this->_options['use_private_vars']) {
- $this->_options['fields'] =
- array_keys(get_object_vars($this->_dataobject));
- } else {
- $this->_options['fields'] =
- array_keys($this->_dataobject->toArray());
+ if ($initial) {
+ if (!$this->_options['fields']) {
+ if ($this->_options['use_private_vars']) {
+ $this->_options['fields'] =
+ array_keys(get_object_vars($this->_dataobject));
+ } else {
+ $this->_options['fields'] =
+ array_keys($this->_dataobject->toArray());
+ }
}
- //$this->_options['fields'] =
- // array_filter(array_keys(get_object_vars($this->_dataobject)),
array(&$this, '_fieldsFilter'));
+ $initial = false;
}
- $fieldList = $this->_options['fields'];
// Build DataSet
$rec = array();
- foreach ($fieldList as $fName) {
+ foreach ($this->_options['fields'] as $fName) {
$getMethod = 'get' . ucfirst($fName);
if (method_exists($this->_dataobject, $getMethod)) {
//$rec[$fName] = $this->_dataobject->$getMethod(&$this);