Re: Re: cvs: php4 /pear DB.php /pear/DB pgsql.php

From: Date: Tue, 27 Mar 2001 11:43:49 +0000
Subject: Re: Re: cvs: php4 /pear DB.php /pear/DB pgsql.php
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-113@lists.php.net to get a copy of this message
Jon Parise wrote: > > On Mon, Mar 26, 2001 at 11:31:50PM -0000, Thomas V.V.Cox wrote: > > > - function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT) > > + function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=0) > > { > > if ($fetchmode == DB_FETCHMODE_DEFAULT) { > > $fetchmode = $this->dbh->fetchmode; > > } > > - return $this->dbh->fetchInto($this->result, $arr, $fetchmode); > > + return $this->dbh->fetchInto($this->result, $arr, $fetchmode, > > $rownum=0); > > Setting $rownum equal to zero in that last call to fetchInto() doesn't > appear to make much sense, especially because you specify a default > value for that parameter in the function definition. > Yes, perhaps it can confuss a little but you have to see the next line: function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=0) { $rownum = ($rownum > 0) ? $rownum : $this->row[$result]; So, if the $rownum param is not given, $rownum=0 and because it isn't greater than 0, it will take the last row ($this->row[$result]) plus 1. If you prefer, I can change the default value for null, but I repeat, this method *does* work. Tomas V.V.Cox

« previous php.pear.dev (#113) next »