2012/4/24 Johannes Schlüter <johannes.schlue...@oracle.com>: > 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.
Right, NP > >> 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*. Aha, I like when an internals guy teach me internals stuff :) So, OK for 5.3 , what about supporting that for >=5.4 ? > > 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. That was my first question : Is it better to provide mysqlnd API through all 3 MySQL extensions, or through a common mysqlnd_***() API ? I understand your thoughts, but I disagree as I think it would be much more clean to expose it via mysqlnd_***() API than through each MySQL ext (and for PDO that would be even more dirty). That would as well add more and more #ifdef MYSQLND inside their source... I was thinking the same way libxml2 API is provided inside ext/libxml instead of through each PHP XML extension API. > >> 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 ;-) ;-) OK, but that can be done easily. More and more people use pdo_mysql and could be able to not compile other MySQL extensions (I got some machines where only pdo_mysql is compiled in) > >> 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). More, I'm gonna work on a patch to feed the bug report with ;-) Stats are not the hardest part of ext/mysqlnd :) Julien.P -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php