Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86553 invoked from network); 24 Apr 2012 12:28:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2012 12:28:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:49388] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/29-34190-15C969F4 for ; Tue, 24 Apr 2012 08:28:02 -0400 Received: by eaao10 with SMTP id o10so139121eaa.29 for ; Tue, 24 Apr 2012 05:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Lwbij0tbW1u1pQFzSATG9OJravymoUXEyKoFRPZPBRA=; b=dsVbsv5cYTlc+OdL/FjGedTMO5xkApr6G8CJ/Ok2kvNZQZKYwMfc0SWBCctWJX7fQP b3HHfX0ucoS8ZFQED6OQiq+hfXMwjpi/OnWMpbPOxTKd2BLcHSOtnSUS3TrH+KCNhVPm FRQgqyRvtI0uQk/ObETvMV5CJ8gLNWyMAhI+0m+TvPLG2vtlnRf/zWD/B/defChwhN70 hyDF0rJvD4cVyC9tLbp43SSeYuSTer7QuvIjZLCcVtGyWh8giB961DhkeKUqPjkTSHBx ShLeucG72EPQdUfLsyBrl1rAJh8BBoEltfm6keOdtr1uBPV/0lP7mIDCm3sWjr15CHOs wn4w== Received: by 10.213.10.10 with SMTP id n10mr1725836ebn.209.1335270479280; Tue, 24 Apr 2012 05:27:59 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.213.29.83 with HTTP; Tue, 24 Apr 2012 05:27:18 -0700 (PDT) In-Reply-To: <1335269202.13732.34.camel@guybrush> References: <1335269202.13732.34.camel@guybrush> Date: Tue, 24 Apr 2012 14:27:18 +0200 X-Google-Sender-Auth: fTuLlzsjEMGpGhtqWuKbeINqpPQ Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Expose mysqlnd API through all MySQL extensions From: jpauli@php.net (jpauli) 2012/4/24 Johannes Schl=FCter : > 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 >=3D5.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