hi thanks for answer
but this is an effect i want to achieve especially
i want to fetch a row on the while cond but also inside to fetch anotehr row
under certain conditions
and then continue fetching other rows (if left)
when i loop back to while cond
this is like the old dbase :
while not eof
a=field
while a=field
do smthing
skip
end
do smthing
skip if not eof
end
also the fetch is passed to the bind_columns with each call , so it is
captured.
would this work then :
> my $row;
> while($row = $sth->fetch) {
> print @$row, "\n";
> if ( $newrow=$sth->fetch ){
> stmt1;
> }
> }
>
----- Original Message -----
From: "PARLEY,JON (HP-MountainView,ex1)" <[EMAIL PROTECTED]>
To: "'pascal barbedor'" <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 6:40 PM
Subject: RE: refetch does not work
> You are toying with your loop invariants! Capture the results of each
fetch
> and do your condition on those ie...
>
> my $row;
> while($row = $sth->fetch) {
> print @$row, "\n";
> if ( cond on $row){
> stmt1;
> }
> }
>
> --Thunder
>
> -----Original Message-----
> From: pascal barbedor [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 12, 2002 9:30 AM
> To: [EMAIL PROTECTED]
> Subject: Fw: refetch does not work
>
>
>
> ----- Original Message -----
> From: pascal barbedor
> To: [EMAIL PROTECTED]
> Sent: Wednesday, June 12, 2002 6:27 PM
> Subject: refetch does not work
>
>
> hi
>
> on a recent DBI perl 5.6.1 with DBD Mysql
>
> I have a construct like this
>
> my ($sth , $dbh) ;
>
> $sth=$dbh->execute ;
>
> $sth->bind_columns(\($c1,$c2));
>
> while ($sth->fetch) {
>
> print $c1,$c2;
>
> if (cond) { $sth->fetch } ;
>
> }
>
>
> the second fetch inside while loop is not supported, i have a message cant
> call method fetch on an undefine value.
>
> if I drop the second fetch, everything works perfect
>
> if I have independant $sth->fetch calls it works, but when I put one in a
> while loop, looks like i can't put any other one after.
>
>
> has anybody an explanation ?
>
> thanks pascal
>
>
>
>
>
>