in reply to Re: DBI SQL Query Question
in thread DBI SQL Query Question
Also, you should not save the reference in an array, you may get bitten later. Also from the DBI docs:Because of the extra work "fetchrow_hashref" and Perl have to perform, it is not as efficient as "fetchrow_arrayref" or "fetchrow_array".
If you really need to save all the results in an array of hashes, use selectall_arrayref (this changed recently, selectall_hashref use to be the solution to this, but as of DBI 1.20 it now returns a hashref, not an array). If you want to prepare the statement, that's fine, the selectall_* methods will take a sql string or a statement handle as an argument, or you can use one of the new fetchall_* methods.Currently, a new hash reference is returned for each row. This will change in the future to return the same hash ref each time, so don't rely on the current behaviour.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: DBI SQL Query Question
by ehdonhon (Curate) on Jan 11, 2002 at 23:35 UTC |