Expose mysqlnd API through all MySQL extensions
| From: | jpauli | Date: | Tue, 24 Apr 2012 11:35:12 +0000 |
| Subject: | Expose mysqlnd API through all MySQL extensions | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-60270@lists.php.net to get a copy of this message | ||
Hi all,
I'm actually putting my head into ext/mysqlnd and I noticed weird
things about its API.
As you should know, ext/mysqlnd is a replacement for libmysql, that
is, all our 3 MySQL-related extensions may use it, and it is done by
default for 5.4 branch.
However, I've been surprised that ext/mysqlnd expose its API through
ext/mysqli only...
- 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.
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_****().
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 ?
I then suggest to expose ext/mysqlnd API through itself
(http://lxr.php.net/xref/PHP_5_3/ext/mysqlnd/php_mysqlnd.c#33) in
php_mysqlnd.c or create a new php_mysqlnd_fe.c
For the actual functions, please refer to
http://lxr.php.net/xref/PHP_5_3/ext/mysqli/mysqli_nonapi.c#392
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 ?
Cheers,
Julien