peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.33k stars 202 forks source link

MS SQL Server PDO incorrectly returns number of affected rows on update #1060

Closed Alikont closed 2 years ago

Alikont commented 2 years ago

For updating operations via PDOStatement the rowCount property should show number of affected rows

Documentation

Currently for MS SQL Server the rowCount() for successful updates returns 0.

image

The RowCount is zero, while RecordsAffected is 1 (correct).

It may be related to ResultResource implementation, that uses result set as a source for RowCount property, and PDOStatement simply uses the ResultResource.RowCount directly. PDOStatement probably should use RecordsAffected property instead.

jakubmisek commented 2 years ago

I see, rowCount() in PeachPie shows number of rows in result instead of number of affected rows.

Will be fixed.