Re: Stupid newbie question?



Your best bet (and fastest) would be to use

fetchall_arrayref()

like this

my $sth = $dhh->prepare("select * from my_countries");
$sth->execute();
my $reff_array = $sth->fetchall_arrayref();

then you can use $ref_array anyway you want without going back to the DB.

foreach my $row (@$reff_array )
{
....

}



Like the others said the data in the array will be stale but I do not think
you care to much about that.

The point here to remeber is that DBI result sets forward only reads.

cheers


.



Relevant Pages

  • Re: Memory access problem with DBI or DBD-Mysql?
    ... I'll look into this issue and see if indeed the pointer is stale. ... recent version of OpenBSD have a new kind of memory handling that make the programs segfault when they try to access no allocated memory. ... I'm using DBI 1.45 and DBD-Mysql 2.9008. ...
    (perl.dbi.users)
  • Re: + clocksource-increase-initcall-priority.patch added to -mm tree
    ... I don't see that behaviour on my machines and nobody complains about ... I don't care about stale comments. ... Point me to a bug report ...
    (Linux-Kernel)
  • Re: (Fwd) DBIs method for reading [row x,field y]
    ... If you do not care ... Bob, please simmer down and give some credit to both Tim and this list. ... it is very active and includes hundreds of DBI users and developers. ... Another reason to keep questions on the list rather than in personal mail is that an issue that impacts one impacts all and the only way for all to know about it is to see it on the list. ...
    (perl.dbi.users)
  • Re: Why I dumped Linux and went back to Windows.
    ... > A) As if I might care. ... I don't give a fuck who you ... > C) linuxfux only know lame and stale. ...
    (alt.os.linux)
  • Re: Why I dumped Linux and went back to Windows.
    ... > A) As if I might care. ... I don't give a fuck who you ... > C) linuxfux only know lame and stale. ...
    (alt.os.linux.redhat)