cvs: pear /HTML_QuickForm/Elements select.php

From: Date: Mon, 21 Jan 2002 12:42:15 +0000
Subject: cvs: pear /HTML_QuickForm/Elements select.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2035@lists.php.net to get a copy of this message
mansion Mon Jan 21 07:42:15 2002 EDT Modified files: /pear/HTML_QuickForm/Elements select.php Log: Modification suggested by Brian Abent : In loadDbResult(), method now checks if fetchRow() returns a Pear error or an array. If neither, it returns a new Pear error. Index: pear/HTML_QuickForm/Elements/select.php diff -u pear/HTML_QuickForm/Elements/select.php:1.3 pear/HTML_QuickForm/Elements/select.php:1.4 --- pear/HTML_QuickForm/Elements/select.php:1.3 Tue Dec 11 14:45:47 2001 +++ pear/HTML_QuickForm/Elements/select.php Mon Jan 21 07:42:14 2002 @@ -17,7 +17,7 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: select.php,v 1.3 2001/12/11 19:45:47 sebastian Exp $ +// $Id: select.php,v 1.4 2002/01/21 12:42:14 mansion Exp $ require_once("HTML/QuickForm/Elements/element.php"); @@ -271,11 +271,17 @@ $this->setValue($values); } $fetchMode = ($textCol && $valueCol) ? DB_FETCHMODE_ASSOC : DB_FETCHMODE_DEFAULT; - while (is_array($row = $result->fetchRow($fetchMode)) ) { - if ($fetchMode == DB_FETCHMODE_ASSOC) { - $this->addOption($row[$textCol], $row[$valueCol]); + while ($row = $result->fetchRow($fetchMode)) { + if (PEAR::isError($row)) { + return $row; + } elseif (is_array($row)) { + if ($fetchMode == DB_FETCHMODE_ASSOC) { + $this->addOption($row[$textCol], $row[$valueCol]); + } else { + $this->addOption($row[0], $row[1]); + } } else { - $this->addOption($row[0], $row[1]); + return new PEAR_ERROR('Invalid return value from DB_result->fetchRow'); } } return true;

« previous php.pear.cvs (#2035) next »