Re: Expose mysqlnd API through all MySQL extensions
| From: | Johannes Schlüter | Date: | Tue, 24 Apr 2012 12:06:42 +0000 |
| Subject: | Re: Expose mysqlnd API through all MySQL extensions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60271@lists.php.net to get a copy of this message | ||
On Tue, 2012-04-24 at 13:35 +0200, jpauli wrote:
> - mysqli_get_client_stats()
> - mysqli_get_connection_stats()
> - mysqli_get_cache_stats()
>
> Those three functions are ext/mysqlnd related, they are #ifdef 'ed in
> the source code of ext/mysqli and not defined if ext/mysqli has been
> compiled against libmysql.
With libmysql we don't have the statistics, therefore they are useless.
> There is a mismatch in the naming and the place here, those 3
> functions should be part of ext/mysqlnd API, and be named
> mysqlnd_****().
Until 5.4 we couldn't do "mysqlnd_get_connection_stats" as there was no
way to get from an arbitrary zval (PDO or mysqli object, mysql resource)
to the corresponding MYSQLND*.
The other reason is that one idea for mysqlnd was that it doesn't expose
anything to the userland while ext/mysql is legacy and get's no
additions and PDO would allow user-defined functions,while that's not
really nice.
> What if I choose to only compile pdo_mysql (against mysqlnd) and not
> mysqli ?? I then would be able to use mysqlnd, but I would have access
> to its statistics, as its functions are part of ext/mysqli... Strange
> as well as embarrassing isn't it ?
You simply shouldn't do that ;-)
> Second, I would suggest to add a function that would reset the global
> stat counter. The only way to do it actually is by passing in MINIT(),
> so by restarting PHP ; it may be useful, and not very hard to develop,
> to create a mysqlnd_stats_reset($someOptionsIfNeeded) function.
>
> Any ideas, comments ?
Feel free to open a ticket in the bug tracker and assign it to us (mysql
user).
johannes
--
Johannes Schlüter, MySQL Engineering Connectors and Client Connectivity
ORACLE Deutschland B.V. & Co. KG, Riesstr. 25, D-80992 München