Thread: DBD::Pg 1.00
DBD::Pg 1.00 won't allow me to use the following the code anymore ---------- $s=$dbh->prepare('select * from table'); $s->execute or die $dbh->errstr; while(my @a=$s->fetchrow_array()) { ... do something } while(my @a=$s->fetchrow_array()) { .. do something else } ----------- It was fine before with 0.9? Now I need another execute statement before the second while statement. Thanks
On Wed, 30 May 2001 08:07:11 -0400, newsreader@mediaone.net wrote: > DBD::Pg 1.00 won't allow me to use the following > the code anymore > > ---------- > $s=$dbh->prepare('select * from table'); > $s->execute or die $dbh->errstr; > while(my @a=$s->fetchrow_array()) > { > ... do something > } > while(my @a=$s->fetchrow_array()) > { > .. do something else > } > ----------- > > It was fine before with 0.9? > > Now I need another execute statement before > the second while statement. That's because previous versions of DBD::Pg had a bug which didn't remove the Active attribute from statement handles whichall rows had been fetched from. The new behaviour is mre correct. -- Peter Haworth pmh@edison.ioppublishing.com "I'm just a mere programmer" -- James Counihan
On Wed, May 30, 2001 at 04:02:51PM +0100, Peter Haworth wrote: > On Wed, 30 May 2001 08:07:11 -0400, newsreader@mediaone.net wrote: > The new behaviour is mre correct. > Why? The old behavior is better. Less coding.
On Wed, 30 May 2001 12:54:17 -0400, newsreader@mediaone.net wrote: > On Wed, May 30, 2001 at 04:02:51PM +0100, Peter Haworth wrote: > > On Wed, 30 May 2001 08:07:11 -0400, newsreader@mediaone.net wrote: > > The new behaviour is mre correct. > > > > Why? The old behavior is better. Less coding. It's also less compliant with the DBI spec. I suspect that this only works because the Postgres client library fetches theentire result set into memory. For other databases where it is not possible to fetch rows from an exhausted result set,the specified behaviour makes a lot more sense. Also, this stops DBD::Pg complaining about destroying open statement handles. The DBI says that you don't need to explicitlyfinish statements after fetching all the rows, so this is good, too. -- Peter Haworth pmh@edison.ioppublishing.com "Ok, print the message, then put it in your shoe and put your shoe in front of the fireplace... then wait till Santa come and give the code to you ;-) Hey! this is not mod_santa list !" -- Fabrice Scemama on the mod_perl list