note 59100 added to function.pdostatement-rowcount

From: Date: Sat, 26 Nov 2005 07:11:25 +0000
Subject: note 59100 added to function.pdostatement-rowcount
Groups: php.notes 
Request: Send a blank email to php-notes+get-99125@lists.php.net to get a copy of this message
I find it spellbinding that there is no recordCount() or similar method for counting the number of SELECT results in a PDOStatement object. The only possible explanation I can fathom for this is that the query code is avoiding doing any implicit counting to reduce overhead and leaving it up to the user to explicity count them. Fair enough, so why not make a numRows or similar method which does just that? I would love to heard a good reason why this is as it is, but I really cannot think of any good reason. And the previous post about a second COUNT(*) query to deal with it is bang on. That's a terrible workaround, not just from an integrity point of view, but also the overhead of more database access is going to be greater (certainly with complex queries with lots of joining) than simply counting the number of rows in the object's results member property. ---- Manual Page -- http://www.php.net/manual/en/function.pdostatement-rowcount.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59100 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59100&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59100&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99125) next »