Re: cvs: php-src(PHP_5_2) /ext/mysqli mysqli_nonapi.c
| From: | Andrey Hristov | Date: | Sat, 14 Apr 2007 15:30:54 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_2) /ext/mysqli mysqli_nonapi.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-43881@lists.php.net to get a copy of this message | ||
Hi Tony,
Antony Dovgal wrote:
> tony2001 Sat Apr 14 10:35:05 2007 UTC
>
> Modified files: (Branch: PHP_5_2)
> /php-src/ext/mysqli mysqli_nonapi.c
> Log:
> MFH
>
>
>
> http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.54.2.7.2.2&r2=1.54.2.7.2.3&diff_format=u
> Index: php-src/ext/mysqli/mysqli_nonapi.c
> diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.54.2.7.2.2
> php-src/ext/mysqli/mysqli_nonapi.c:1.54.2.7.2.3
> --- php-src/ext/mysqli/mysqli_nonapi.c:1.54.2.7.2.2 Mon Jan 1 09:36:03 2007
> +++ php-src/ext/mysqli/mysqli_nonapi.c Sat Apr 14 10:35:05 2007
> @@ -15,7 +15,7 @@
> | Author: Georg Richter <georg@php.net> |
> +----------------------------------------------------------------------+
>
> - $Id: mysqli_nonapi.c,v 1.54.2.7.2.2 2007/01/01 09:36:03 sebastian Exp $
> + $Id: mysqli_nonapi.c,v 1.54.2.7.2.3 2007/04/14 10:35:05 tony2001 Exp $
> */
>
> #ifdef HAVE_CONFIG_H
> @@ -39,6 +39,9 @@
> char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
> unsigned int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len
> = 0;
> long port=0;
> +#if MYSQL_VERSION_ID > 50012
> + my_bool my_true = 1;
> +#endif
>
> if (getThis() && !ZEND_NUM_ARGS()) {
> RETURN_NULL();
> @@ -84,6 +87,10 @@
> }
> #endif
>
> +#if MYSQL_VERSION_ID > 50012
> + mysql_options(mysql->mysql, MYSQL_OPT_RECONNECT, (const char *)&my_true);
> +#endif
> +
> if (!socket) {
> socket = MyG(default_socket);
> }
>
doing this is definitely bad. Probably it makes mysql_ping() to work but
having reconnect being disabled has its reasons. Once connection is
broken TXs are lost, connection variables too. Reconnecting under the
hood is bad behavior. mysql_ping() can work without mysql->reconnect
being set to 1. It will just won't reconnect and return an error. Which
I think is pretty normal. The app should check and decide whether to
reconnect or die. Thus, please _revert_ the patches you committed to
ext/mysql and ext/mysqli. The report is bogus.
Even if the report wasn't bogus, the fix is not complete, as for
5.0.3 < libmysql < 5.0.13 , it doesn't work.
Andrey