LA.pm: Prepend

Arkadiy Sudarikov asudarikov at xceed.com
Fri Oct 5 13:50:38 CDT 2001


my $sth->prep...
$sth->execute($foo, $bar$, $baz);

my $records=0;
while (my $hashref=$sth->fetchrow_hashref) {
 ++$records;
 print FILE $hashref->{'Data'}, "\n" }

print FILE $records, "\n";

I kinda need to accomplish this, only last line that prints $records needs
to go in the beginning of the file...
Maybe something like seek, read, I-don't-know-what...

Thanks, though!


-----Original Message-----
From: Andrew Baio [mailto:andy at waxy.org]
Sent: Friday, October 05, 2001 11:41 AM
To: Arkadiy Sudarikov
Subject: Re: LA.pm: Prepend


At 01:28 PM 10/05/2001 -0500, you wrote:
>I can do another (SELECT COUNT(*)) query, but don't want to.
>I can put all info fetched into list and then count, but don't want to.
>And... I can't use $sth->rows; with my (Sybase) DBD.

         You're out of luck, I'm afraid.  There's no way
         to get a count of records retrieved in Sybase
         without retrieving them all.

         So either load them into an array and get the
         count of the array, or append your output to
         a variable and increment a counter.  When you're
         done doing either, write out to a file.

                                             -- Andy.




More information about the Losangeles-pm mailing list