php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51499 mysql_warning_count to be implemented
Submitted: 2010-04-07 18:37 UTC Modified: 2010-08-26 13:53 UTC
Votes:24
Avg. Score:4.5 ± 1.0
Reproduced:19 of 19 (100.0%)
Same Version:9 (47.4%)
Same OS:10 (52.6%)
From: andrew at ajohnstone dot com Assigned:
Status: Open Package: PDO related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andrew at ajohnstone dot com
New email:
PHP Version: OS:

 

 [2010-04-07 18:37 UTC] andrew at ajohnstone dot com
Description:
------------
The warning count is sent in the returned OK packet from a executed statement, however there is no functionality within PDO to extract, how many warnings were triggered from the statement.

This will save on round trips to the database to identify whether data could have been truncated for example.

http://dev.mysql.com/doc/refman/5.0/en/mysql-warning-count.html
http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Types_Of_Result_Packets

This would need to be implemented for other drivers too.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-26 13:53 UTC] uw@php.net
Well, JDBC has a getWarnings() method as part of its Statement class. I think PDO should have something similar and do it in a generic way. So, even if there's a shortcut for MySQL, I'd rather look into how to do this on the upper PDO level than adding the shortcut to PDO_MySQL. PDO should try to have everything in the core that can be made part of the core. Without knowing about the other databases, I wonder if PDO could follow the JDBC example.
 [2021-02-10 11:00 UTC] daniel dot beardsley at gmail dot com
I opened a pull request on github to add this feature:
https://github.com/php/php-src/pull/6677
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 16:01:24 2021 UTC