In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Tim Bunce) wrote:
> On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote: > > On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote: > > > > > my %db; > > > $sth->bind_columns( \( @db{ @{ $sth->{NAME} } } ));# magic > > > > > > while ($sth->fetch) > > > { > > > #... and no worries about which order the columns get returned in > > > #... since you access them via the $db{ColumnName} method :) > > > > What's the advantage of this approach over > > > > while(my $db = fetchrow_hashref) { > > ... > > } > > > > and accessing the datae through $db->{ColumnName}? > > Speed! It's many times faster (assuming the loop is empty :) > > (But use $sth->{NAME_lc} or $sth->{NAME_uc} for portability. > > Tim. with the exception of my case where neither mod_perl nor Apache::DBI is compiled in.. in the php vs perl thread earlier this (last?) month, I posted some "benchmarks" done by the site admin on a search of 5100 rows for "c" by their ph script and my perl script.. the results were staggeringly different, even with the help of this (see the script I posted in that thread for details on what I was doing) the thread issues are posted here: <[EMAIL PROTECTED]> -- Scott R. Godin | e-mail : [EMAIL PROTECTED] Laughing Dragon Services | web : http://www.webdragon.net/