develooper Front page | perl.dbi.users | Postings from December 2006

Re: out of memory

Thread Previous | Thread Next
From:
Ron Savage
Date:
December 29, 2006 18:34
Subject:
Re: out of memory
Message ID:
20061230132830.546107@ron
On Fri, 29 Dec 2006 14:28:32 -0800, louis fridkis wrote:

Hi Louis

> Thanks for the suggestions. But, wouldn't it just be better to
> switch back to using fetchrow_array()? Is there any advantage to
> using bind_columns in this case?

Sometimes 'better' refers to personal preference rather than a clear-cut matter
of coding convention or style. I'd say suit yourself, unless there is a clear
advantage doing things in one particular way.

This is from my tiny list of DBI best practices:

Use prepare_cached(), and then:

$sth->execute;
my %row;
$sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } ));
while ($sth->fetch)
{
	print "$row{region}: $row{sales}\n";
}

Actually, I'd like to see a best practices doc alongside the DBI doc, unless
there is already such a doc (and I'm sure I'll get told if there is).

--
Cheers
Ron Savage, ron@savage.net.au on 30/12/2006
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About