Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getRowCount with SQLSRV driver #433

Open
pswmauro opened this issue Jan 24, 2023 · 1 comment
Open

getRowCount with SQLSRV driver #433

pswmauro opened this issue Jan 24, 2023 · 1 comment

Comments

@pswmauro
Copy link

pswmauro commented Jan 24, 2023

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
Copy link
Collaborator

milo commented Jan 25, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants