> From: Juergen Sauer [mailto:[EMAIL PROTECTED]]
> This is my actual problem in Perl-Source:
> Before this there were successfully selected and worked out the
> tablestructure using the "COLUMNS" table. I did the same
> procedure, using
> an other $query String.
> The error is $sth->rows contains very time the same wron #count for
> tatarows, "-1". although ther are rows. This sniplet does not
> select and
> receive the really existing data rows. The source DBD Driver is
> DBI::Adabas.
> $sth=$db->prepare($query);
> $sth->execute()
> or return;
>
> my $zeilen=$sth->rows;
I don't know about Adabas, but many DBD's do not have a row count
until after the rows are fetched. So you're better off fetching
all of the rows and THEN seeing if the count is zero.
The '$sth->execute() or return' line does not look right either.
Why check the status of execute if you're not going to check the
prepare or anything else? If you use RaiseError, you can let DBI
do all the checking for you, and you wouldn't need the 'or return'.
If you don't want your program to die() on an error, then use
'eval { DBI code or subroutine }', and then check $@ to catch
errors.
HTH,
Douglas Wilson