RE: Stupid newbie question?



Concerning stale data, depending on your application's design, you might
want to set AutoCommit to 0 (off). You can do this as an option in
connect, like this:

my $dbh = DBI->connect( ... { AutoCommit => 0 } );

Once you do this, the underlying database will treat all your DB
operations as a single transaction (if the DB supports transactions,
which most do) until you issue either a commit or a rollback.

Within a transaction, all operations are atomic and consistent.

-Will


-----Original Message-----
From: John Scoles [mailto:scoles@xxxxxxxxxxx]
Sent: Monday 26 June 2006 07:29
To: dbi-users@xxxxxxxx
Subject: 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






- - - - - Appended by Scientific Atlanta, a Cisco company - - - - -
This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.

.