RE: [PEAR] MDB questions

From: Date: Wed, 25 Dec 2002 12:16:24 +0000
Subject: RE: [PEAR] MDB questions
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3068@lists.php.net to get a copy of this message
Hi, for all people used to either Metabase or PEAR DB and wondering how to best learn how MDB differs from them you should look at the respecitive wrapper, which always gets installed when you use the PEAR installer. On the web you will find them here: PEAR DB Wrapper: http://cvs.php.net/co.php/pear/MDB/MDB/peardb_wrapper.php Metabase Wrapper: http://cvs.php.net/co.php/pear/MDB/MDB/metabase_wrapper.php Regards, Lukas Smith smith@dybnet.de _______________________________ DybNet Internet Solutions GbR Reuchlinstr. 10-11 Gebäude 4 1.OG Raum 6 (4.1.6) 10553 Berlin Germany Tel. : +49 30 83 22 50 00 Fax : +49 30 83 22 50 07 www.dybnet.de info@dybnet.de > -----Original Message----- > From: Lukas Smith [mailto:smith@dybnet.de] > Sent: Tuesday, December 24, 2002 12:36 AM > To: 'Michael Raidel'; pear-general@lists.php.net > Subject: RE: [PEAR] MDB questions > > > -----Original Message----- > > From: Michael Raidel [mailto:raidel@i-one.at] > > Sent: Monday, December 23, 2002 8:50 PM > > To: pear-general@lists.php.net > > Subject: Re: [PEAR] MDB questions > > > > Hello to all, > > > > I had the same problem as Lorenzo Alberton with fetchRow on more than > > one result but a slightly different solution and would be interested > in > > your opinion. > > > > >5) I tried some queries with MDB, and all worked fine for one-row > > >results. On the other hand, while looping thru a multi-row result I > > >could only fetch the first row. > > > > > > The lines which cause the problem are: > > > if (!$this->options['autofree'] && $res != NULL) { > > > $this->freeResult($result); } > > > > I changed the first line to this: > > if (!$this->options['autofree'] && $res == NULL) { > > so that freeResult is only called, when the query returns no result. > IMO > > the !$this->options['autofree'] is there to prevent freeResult from > > being called a second time, when it is already done in fetchInto. (the > > same line in fetchOne, fetchCol and fetchAll also has to be changed) > > > > If this is true, the line > > > if ($this->options['autofree'] && $res != NULL) { > > would be no permanent solution. > > Actually all fetch[one|col|row|all] methods on the methods that make use > if these methods (query[one|col|row|all] and get[one|col|row|all|assoc]) > free the result sets. If autofree is enabled they don't as then > fetchInto will already have done that. > > This means if you want to fetch several rows with multiple columns you > should use one of the [fetch|query|get]all methods (or getAssoc). If you > want to fetch several rows with just one column you should use > [fetch|query|get]col. > > Regards, > Lukas > > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.general (#3068) next »