Bug #80142 [NEW]: PDO provides no way to get number of rows in result

From: Date: Wed, 23 Sep 2020 17:40:57 +0000
Subject: Bug #80142 [NEW]: PDO provides no way to get number of rows in result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229185@lists.php.net to get a copy of this message
From: teo8976 at gmail dot com Operating system: all PHP version: Irrelevant Package: PDO MySQL Bug Type: Bug Bug description:PDO provides no way to get number of rows in result Description: ------------ MySQLi has $result->num_rows that tells you the number of rows in a result. There are countless use cases for wanting to know the number of results before fetching them (I'm not even saying "without" fetching them because then you could do a COUNT() query to begin with). There's no way to do that in PDO. If you have already executed a query and want to know the number of rows in the result, you need to fetch them all, or to do an extra COUNT query. That is ridiculous. This is a very well known crippling limitation in PDO, how comes it hasn't been fixed yet?? Forums are full of questions like "how to get the row count in PDO", and obviously the answers are all pathetically insufficient workarounds. -- Edit bug report at https://bugs.php.net/bug.php?id=80142&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80142&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80142&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80142&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80142&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80142&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80142&r=support Expected behavior: https://bugs.php.net/fix.php?id=80142&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80142&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80142&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80142&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80142&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80142&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80142&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80142&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80142&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80142&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80142&r=mysqlcfg

« previous php.bugs (#229185) next »