dg / dibi

Dibi - smart database abstraction layer
https://dibiphp.com
Other
487 stars 135 forks source link

getRowCount with SQLSRV driver #433

Open pswmauro opened 1 year ago

pswmauro commented 1 year ago

Version: latest (4.2.7) on windows with PHP 8.1 Correctly installed Microsoft SQL Server driver for PHP. Connection inizialized with: $db = new Dibi\Connection([ 'driver' => 'sqlsrv', 'host' => 'localhost', 'username' => 'user', 'password' => 'password', 'database' => 'TEST', 'charset' => 'UTF-8', ]); I can successfully exec $result = $db->query($qry) and $all = $result->fetchAll(); but if use $result->getRowCount() it throws exception "Row count is not available for unbuffered queries".

milo commented 1 year ago

It is thrown by driver because the SQLServer API does not offer selected rows count function. You have to fetch all rows and count them manually.