[patch] mysql_warning_count() for ext/mysql
| From: | Jille Timmermans | Date: | Mon, 12 Oct 2009 15:03:20 +0000 |
| Subject: | [patch] mysql_warning_count() for ext/mysql | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-45742@lists.php.net to get a copy of this message | ||
Hello all,
Not sure whether this is the right place to post; but it seemed a little bit
better than php-db@.
I have 'implemented' MySQL's mysql_warning_count() function. (
http://dev.mysql.com/doc/refman/5.1/en/mysql-warning-count.html )
mysql_warning_count() is available in MySQL's C-api in >3.23, >4.1 and >5
This function returns the number of warnings from the previous query. In some
queries (INSERT INTO .. VALUES (..), (..); INSERT INTO .. SELECT; etc)
mysql_info() was usable to return the number of warnings; but for single-row
inserts mysql_info() returns false.
The function is very straightforward, almost the same as mysql_thread_id().
The patch is available at http://jille.hexon.cx/mysql-warning-count.diff
It is based on PHP 5.3.0 and at least works for me.
-- Jille