Ing. Branislav Gerzo wrote:
Hi all,

I get data from DB with:
while (my ($id, $post_text) = $getpost->fetchrow_array) {

is there a way how much columns are selected wihout select (fetch)
them all, or using count(*) function ?

In the general case, no.

DBI provides the rows() method:

  my $rows = $sth->rows;

But for a SELECT query, most drivers don't return the correct value until all the rows have been fetched. Some drivers may return a proper value after execute() is called, so you have to check your DBD driver documentation.

If you simply want a row count, using SELECT count(*) is the proper approach.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to