dibi icon indicating copy to clipboard operation
dibi copied to clipboard

getRowCount with SQLSRV driver

Open pswmauro opened this issue 2 years ago • 1 comments

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".

pswmauro avatar Jan 24 '23 15:01 pswmauro

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.

milo avatar Jan 25 '23 07:01 milo