> -----Original Message-----
> From: Gerald Richter [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 17, 2001 2:08 PM
> To: Jack Knight
> Cc: Embeded PERL ML
> Subject: Re: $fields versus !fields
>
>
> >
> > !fields again returns everything, ignoring the DISTINCT.
>
> !fields is wrong and will never work

OK, then the documentation is wrong...

From: http://perl.apache.org/embperl/Recordset.pod.2.html#Search_parameters

$fields
Fields which should be returned by a query. If you have specified multiple
tables the fieldnames should be unique. If the names are not unique you must
specify them along with the tablename (e.g. tab1.field).
NOTE 1: If !fields is supplied at setup time, this can not be overridden by
$fields.

NOTE 2: The keys for the returned hash normally don't have a table part.
Only the fieldname part forms the key. (See !LongNames for an exception.)

NOTE 3: Because the query result is returned in a hash, there can only be
one out of multiple fields with the same name fetched at once. If you
specify multiple fields with same name, only one is returned from a query.
Which one this actually is, depends on the DBD driver. (See !LongNames for
an exception.)

>
> > !Fields displays nothing!
> >
>
> >From the logfile it returns one record:
>
> > DB:  FETCH [0]
> > DB:  FETCH return HASH(0x8438524)
> > DB:  Row::FETCH Batchnum = <1>
> > DB:  FETCH [0]
> > DB:  Row::FETCH Batchdate = <2001-10-12>
> > DB:  FETCH [0]
> > DB:  Row::FETCH Id = <<undef>>
>
> I don't know how much records you are expecting, but this seems correct to
> me
>
> Gerald

So why does the 1 record not get displayed with the following code?

    <td align=center>[+ $BatchData[$row]{Batchnum} +]</td>
       <td align=center>[+ $BatchData[$row]{Batchdate} +]</td>
       <td align=center><input type=checkbox name=[+ $BatchData[$row]{Id} +]
value="Y"></td>
    </tr>

Also the query, in this case should return 8 rows, verified from running the
SQL direct from the CLI...
SELECT DISTINCT Batchnum, Batchdate from database.Batchdata;
... returns 8 rows.

Jack


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to