punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
But I was wondering if there's an opportunity to use it to improve the efficiency of queries like this:while ($data = $sth->fetchrow_array()) { $hash{$data} = undef; }
or$sql = 'SELECT col_1 FROM theTable'; ..... while ($data = $sty->fetchrow_array()) { push @my_list, $data; }
Thanks.$sql = 'SELECT col_1, col_2, col_3, col_4, col_5 FROM theTable'; ..... while (@data = $sty->fetchrow_array()) { $my_hash{$data[0]} = [ $data[1], $data[2], $data[3], $data[4] ]; }
Forget that fear of gravity,
Get a little savagery in your life.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use undef in DBI sql query result collection
by dragonchild (Archbishop) on Feb 17, 2005 at 13:26 UTC | |
|
Re: How to use undef in DBI sql query result collection
by rdfield (Priest) on Feb 17, 2005 at 14:36 UTC | |
by dragonchild (Archbishop) on Feb 17, 2005 at 14:41 UTC |