coolmichael has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use DBI; use Benchmark; my $dbh=DBI->connect("DBI:CSV:f_dir=c:\\\\pdox") || die "opening connection: $DBI::errstr; stopped\n"; my $sql='SELECT * FROM exp'; my $sth=$dbh->prepare($sql) || die "preparing $sql: $DBI::errstr stopped\n"; sub by_bind { my @res=(0 .. 5); $sth->execute() || die "executing $sql: $DBI::errstr stopped\n"; $sth->bind_columns(\$res[0], \$res[1], \$res[2], \$res[3], \$res[4 +], \$res[5]); while($sth->fetch()){} } sub by_arrayref { my @result = (0 .. 5); $sth->execute() || die "executing $sql: $DBI::errstr stopped\n"; while($sth->fetchrow_arrayref(\@result)){} } timethese(100, {'bind' => \&by_bind, 'arrayref' => \&by_arrayref}); $dbh->disconnect();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: benchmarking DBI bind columns vs. fetchrow_arrayref
by arturo (Vicar) on Mar 20, 2001 at 19:33 UTC | |
|
(ar0n) Re: benchmarking DBI bind columns vs. fetchrow_arrayref
by ar0n (Priest) on Mar 20, 2001 at 20:09 UTC | |
|
Re: benchmarking DBI bind columns vs. fetchrow_arrayref
by chromatic (Archbishop) on Mar 21, 2001 at 23:55 UTC |