in reply to DBI and bind_columns issue

See your problem starts here

$sqlquery->bind_columns( \( @row{ @{$sqlquery->{NAME_lc} } } ));

Just use fetchrow_hashref

 

rm -rf goners

Replies are listed 'Best First'.
Re^2: DBI and bind_columns issue
by Tux (Canon) on Aug 15, 2014 at 06:12 UTC

    Bad monk. Don't ill-advice. The OP uses the fastest way to fetch data. Your change would lose all speed:

    $ cat test.pl use 5.16.2; use Benchmark qw(:hireswallclock cmpthese); use DBI; my $dbh = DBI->connect (); sub bindc { my $sth = $dbh->prepare ("select * from url"); $sth->execute; my %url; $sth->bind_columns (\@url{@{$sth->{NAME_lc}}}); my $n = 0; while ($sth->fetch) { $n++ } return $n; } # bindc sub ftchh { my $sth = $dbh->prepare ("select * from url"); $sth->execute; my %url; my $n = 0; while (my $ref = $sth->fetchrow_hashref) { $n++ } return $n; } # bindc say "url has ", bindc (), " records"; say "url has ", ftchh (), " records"; cmpthese (10, { bind_columns => \&bindc, fetch_hashref => \&ftchh, }); $ perl test.pl url has 491826 records url has 491826 records s/iter fetch_hashref bind_columns fetch_hashref 1.72 -- -87% bind_columns 0.224 670% -- $

    Enjoy, Have FUN! H.Merijn

      Bad monk. Don't ill-advice. The OP uses the fastest way to fetch data. Your change would lose all speed:

      The OP doesn't get any data really really fast :) With that recommendation he'd get data, 87% slower, but still plenty fast enough :)

Re^2: DBI and bind_columns issue
by Anonymous Monk on Aug 15, 2014 at 03:43 UTC

    also %row and $row are two different variables, you're binding to %row, but you're printing from $row

     

    rm -rf goners