tony2001                Sat Apr 14 10:19:20 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/mysql  php_mysql.c 
  Log:
  MFH: fix #41083 (mysql_ping() requires MYSQL_OPT_RECONNECT to be set since 
MySQL 5.0.13)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.646&r2=1.2027.2.547.2.647&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.646 php-src/NEWS:1.2027.2.547.2.647
--- php-src/NEWS:1.2027.2.547.2.646     Fri Apr 13 14:51:40 2007
+++ php-src/NEWS        Sat Apr 14 10:19:19 2007
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Apr 2007, PHP 5.2.2RC2
+- Fixed bug #41083 (mysql_ping() requires MYSQL_OPT_RECONNECT to be set since 
+  MySQL 5.0.13). (xiaojb at gmail dot com, Tony)
 - Fixed bug #41075 (memleak when creating default object caused exception). 
   (Dmitry)
 - Fixed bug #41063 (chdir doesn't like root paths). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.213.2.6.2.7&r2=1.213.2.6.2.8&diff_format=u
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.213.2.6.2.7 
php-src/ext/mysql/php_mysql.c:1.213.2.6.2.8
--- php-src/ext/mysql/php_mysql.c:1.213.2.6.2.7 Sat Feb 24 02:17:25 2007
+++ php-src/ext/mysql/php_mysql.c       Sat Apr 14 10:19:19 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
  
-/* $Id: php_mysql.c,v 1.213.2.6.2.7 2007/02/24 02:17:25 helly Exp $ */
+/* $Id: php_mysql.c,v 1.213.2.6.2.8 2007/04/14 10:19:19 tony2001 Exp $ */
 
 /* TODO:
  *
@@ -487,6 +487,9 @@
 #if MYSQL_VERSION_ID <= 32230
        void (*handler) (int);
 #endif
+#if MYSQL_VERSION_ID > 50012
+       my_bool my_true = 1;
+#endif
        zval **z_host=NULL, **z_user=NULL, **z_passwd=NULL, **z_new_link=NULL, 
**z_client_flags=NULL;
        zend_bool free_host=0, new_link=0;
        long connect_timeout;
@@ -669,8 +672,14 @@
 #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
                        mysql_init(&mysql->conn);
 
-                       if (connect_timeout != -1)
+#if MYSQL_VERSION_ID > 50012
+                       /* Reconnect has been off by default since MySQL 5.0.3; 
+                          this option is new in 5.0.13 and provides a way to 
set reconnection behavior explicitly. */
+                       mysql_options(&mysql->conn, MYSQL_OPT_RECONNECT, (const 
char *)&my_true);
+#endif
+                       if (connect_timeout != -1) {
                                mysql_options(&mysql->conn, 
MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
+                       }
 
                        if (mysql_real_connect(&mysql->conn, host, user, 
passwd, NULL, port, socket, client_flags)==NULL) {
 #else
@@ -774,8 +783,15 @@
 #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */
                mysql_init(&mysql->conn);
 
-               if (connect_timeout != -1)
-                               mysql_options(&mysql->conn, 
MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
+#if MYSQL_VERSION_ID > 50012
+               /* Reconnect has been off by default since MySQL 5.0.3; 
+                this option is new in 5.0.13 and provides a way to set 
reconnection behavior explicitly. */
+               mysql_options(&mysql->conn, MYSQL_OPT_RECONNECT, (const char 
*)&my_true);
+#endif
+
+               if (connect_timeout != -1) {
+                       mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, 
(const char *)&connect_timeout);
+               }
 
                if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, 
port, socket, client_flags)==NULL) {
 #else

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to