Bug #4027 [Fbk->Csd]: DB_common::setFetchMode not support DB_FETCHMODE_FLIPPED

From: Date: Thu, 07 Apr 2005 14:36:30 +0000
Subject: Bug #4027 [Fbk->Csd]: DB_common::setFetchMode not support DB_FETCHMODE_FLIPPED
References: 1  Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-5885@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=4027&edit=1 ID: 4027 Updated by: danielc@analysisandsolutions.com Reported By: koyama at hoge dot org -Status: Feedback +Status: Closed Type: Bug -Package: DB +Package: Documentation Operating System: Linux PHP Version: Irrelevant Assigned To: danielc New Comment: Turned out to be a mistake in the documentation. DB_FETCHMODE_FLIPPED is only for use in the $fetchmode parameter of getAll(). I've committed changes to CVS that fix the docblocks in DB/common.php source code and the setFetchMode() documentation in the manual. The changes to the manual will show up on Sunday. Previous Comments: ------------------------------------------------------------------------ [2005-04-06 10:16:14] danielc at analysisandsolutions dot com You need to provide a short, self contained test script that uses DB. The test script should set the fetch mode, create a table with a column or two in it, insert a row or two of data, select and fetch into an array producing the problem you're saying then drop the table. ------------------------------------------------------------------------ [2005-04-01 15:28:08] koyama at hoge dot org Description: ------------ In document, it say "DB_FETCHMODE_ORDERED or DB_FETCHMODE_ASSOC, possibly bit-wise OR'ed with DB_FETCHMODE_FLIPPED", but I current implementation can't support bit-wise OR'ed with DB_FETCHMODE_FLIPPED. Reproduce code: --------------- My sample implementation followed: function setFetchMode($fetchmode, $object_class = 'stdClass') { if ($fetchmode == DB_FETCHMODE_OBJECT) { $this->fetchmode = $fetchmode; $this->fetchmode_class = $object_class; } else { if ($fetchmode & DB_FETCHMODE_FLIPPED) { $flipped = DB_FETCHMODE_FLIPPED; $fetchmode ^= DB_FETCHMODE_FLIPPED; } else { $flipped = 0; } switch ($fetchmode) { case DB_FETCHMODE_ORDERED: case DB_FETCHMODE_ASSOC: $this->fetchmode = $fetchmode | $flipped; break; default: return $this->raiseError('invalid fetchmode mode'); } } return DB_OK; } ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=4027&edit=1

« previous php.pear.doc (#5885) next »