This is more a perl question then a DBI one, Laurie.
But here is some code:
my $lcsr = $db->prepare("SQL SELECT query here") || die "Error preparing SQL";
if ($lcsr->execute() || die " Error executing SQL";
my @values = ();
# Retrieve the rows and put the data in variables
while ((@values) = $lcsr->fetchrow) {
push @rows, [EMAIL PROTECTED]; # push the array of fields in
another array
}
}
You can do a similar thing with data hash, just push it onto an array.
> -----Original Message-----
> From: Laurie Vien [mailto:[EMAIL PROTECTED]
> Sent: 08 March 2004 13:32
> To: '[EMAIL PROTECTED]'
> Subject: RE: Can I reset the pointer in a DataHash?
>
>
> Anyone get a chance to address this one yet?
>
> > -----Original Message-----
> > From: Laurie Vien
> > Sent: Friday, March 05, 2004 8:25 PM
> > To: [EMAIL PROTECTED]
> > Subject: Can I reset the pointer in a DataHash?
> >
> > I would like to read all the records from a table in once,
> in a single
> > SELECT, and then use "while($db->FetchRow())" and the "%row =
> > $db->DataHash()" method to process through them.
> >
> > Is there a way to reset the pointer to the beginning of the
> recordset so
> > that I can process the records a second time without
> reading them all back
> > in from the database?
> >
> > I tried just repeating the "while($db->FetchRow())"
> statement after I'd
> > finished the first round of processing, but it didn't work.
> > Thanks ...
> >
> > Laurie A. Vien
> > Sr. Programmer/Analyst
> > Ben & Jerry's Homemade, Inc.
> >
>