[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
: Charles K. Clarkson [CKC], on Saturday, November 27, 2004 at
: 10:21 (-0600) thinks about:
:
: : Here's the method you presented.
: : my $rows = $dbh->selectall_arrayref(
: : 'SELECT sessionid FROM session'
: : );
:
: : my $row_count = $dbh->do(
: : 'SELECT COUNT(sessionid) FROM session' );
:
: no we don't understand each other, why I have to put in my code:
:
: my $rows = $dbh->selectall_arrayref('SELECT sessionid FROM session');
Had he just wanted a record count, why did the OP supply
this statement? I assumed the statement had been executed and
the results used. He now wants the record count. From your
reply, I assume you interpreted his question to mean a record
count *instead of* the statement given.
We are answering two different questions. Only the OP
knows which he wants.
: $sth = $dbh->do('SELECT COUNT(keyword) FROM keywords');
Actually, do() doesn't return a statement handle ($sth).
It returns the number of rows affected ($row_count). Which is
the value we want. It is clearer to use this.
my $row_count = $dbh->do(
'SELECT COUNT(keyword) FROM keywords');
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>