johannes                Thu Jan 22 21:01:59 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/mysqlnd        mysqlnd_enum_n_def.h mysqlnd_libmysql_compat.h 
    /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_fe.c 
                        php_mysqli_structs.h 
    /php-src/ext/mysqli/tests   mysqli_class_mysqli_interface.phpt 
                                mysqli_constants.phpt mysqli_poll.phpt 
  Log:
  MFH: export mysql_refresh
  
  [DOC] This makes mysql_refresh() as described in
        http://dev.mysql.com/doc/refman/6.0/en/mysql-refresh.html
        available as mysqli_Refresh() and mysqli->refresh()
        MYSQLI_REFRESH_BACKUP_LOG is only available when linking libmysql 6.0
        or mysqlnd
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_enum_n_def.h?r1=1.2.2.12&r2=1.2.2.13&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_enum_n_def.h
diff -u php-src/ext/mysqlnd/mysqlnd_enum_n_def.h:1.2.2.12 
php-src/ext/mysqlnd/mysqlnd_enum_n_def.h:1.2.2.13
--- php-src/ext/mysqlnd/mysqlnd_enum_n_def.h:1.2.2.12   Wed Dec 31 11:15:39 2008
+++ php-src/ext/mysqlnd/mysqlnd_enum_n_def.h    Thu Jan 22 21:01:54 2009
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: mysqlnd_enum_n_def.h,v 1.2.2.12 2008/12/31 11:15:39 sebastian Exp $ */
+/* $Id: mysqlnd_enum_n_def.h,v 1.2.2.13 2009/01/22 21:01:54 johannes Exp $ */
 #ifndef MYSQLND_ENUM_N_DEF_H
 #define MYSQLND_ENUM_N_DEF_H
 
@@ -431,6 +431,15 @@
 
 #define MYSQLND_DEFAULT_PREFETCH_ROWS (ulong) 1
 
+#define MYSQLND_REFRESH_GRANT      1   /* Refresh grant tables */
+#define MYSQLND_REFRESH_LOG        2   /* Start on new log file */
+#define MYSQLND_REFRESH_TABLES     4   /* close all tables */
+#define MYSQLND_REFRESH_HOSTS     8    /* Flush host cache */
+#define MYSQLND_REFRESH_STATUS     16  /* Flush status variables */
+#define MYSQLND_REFRESH_THREADS    32  /* Flush thread cache */
+#define MYSQLND_REFRESH_SLAVE      64  /* Reset master info and restart slave 
*/
+#define MYSQLND_REFRESH_MASTER     128 /* Remove all bin logs in the index */
+#define MYSQLND_REFRESH_BACKUP_LOG 0x200000L
 
 #endif /* MYSQLND_ENUM_N_DEF_H */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h?r1=1.1.2.10&r2=1.1.2.11&diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h
diff -u php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h:1.1.2.10 
php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h:1.1.2.11
--- php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h:1.1.2.10      Wed Dec 31 
11:15:39 2008
+++ php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h       Thu Jan 22 21:01:54 2009
@@ -73,6 +73,7 @@
 #define mysql_ping(r)                                  mysqlnd_ping((r))
 #define mysql_real_escape_string(r,a,b,c) mysqlnd_real_escape_string((r), (a), 
(b), (c))
 #define mysql_real_query(r,a,b)                        mysqlnd_query((r), (a), 
(b))
+#define mysql_refresh(conn, options)   mysqlnd_refresh((conn), (options))
 #define mysql_rollback(r)                              mysqlnd_rollback((r))
 #define mysql_select_db(r,a)                   mysqlnd_select_db((r), (a) 
,strlen((a)))
 #define mysql_set_server_option(r,o)   mysqlnd_set_server_option((r), (o))
@@ -118,4 +119,14 @@
 #define mysql_warning_count(r)                 mysqlnd_warning_count((r))
 #define mysql_eof(r)                                   (((r)->unbuf && 
(r)->unbuf->eof_reached) || (r)->stored_data)
 
+#define REFRESH_GRANT      MYSQLND_REFRESH_GRANT
+#define REFRESH_LOG        MYSQLND_REFRESH_LOG
+#define REFRESH_TABLES     MYSQLND_REFRESH_TABLES
+#define REFRESH_HOSTS      MYSQLND_REFRESH_HOSTS
+#define REFRESH_STATUS     MYSQLND_REFRESH_STATUS
+#define REFRESH_THREADS    MYSQLND_REFRESH_THREADS
+#define REFRESH_SLAVE      MYSQLND_REFRESH_SLAVE
+#define REFRESH_MASTER     MYSQLND_REFRESH_MASTER
+#define REFRESH_BACKUP_LOG MYSQLND_REFRESH_BACKUP_LOG
+
 #endif /* MYSQLND_LIBMYSQL_COMPAT_H */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.72.2.16.2.17.2.37&r2=1.72.2.16.2.17.2.38&diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.37 
php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.38
--- php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.37     Mon Jan 12 12:56:01 2009
+++ php-src/ext/mysqli/mysqli.c Thu Jan 22 21:01:55 2009
@@ -17,7 +17,7 @@
   |          Ulf Wendel <u...@php.net>                                     |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli.c,v 1.72.2.16.2.17.2.37 2009/01/12 12:56:01 johannes Exp $ 
+  $Id: mysqli.c,v 1.72.2.16.2.17.2.38 2009/01/22 21:01:55 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -862,6 +862,18 @@
        REGISTER_LONG_CONSTANT("MYSQLI_SERVER_QUERY_WAS_SLOW", 
SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT);
 #endif
 
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_GRANT",      REFRESH_GRANT, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_LOG",        REFRESH_LOG, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_TABLES",     REFRESH_TABLES, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_HOSTS",      REFRESH_HOSTS, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_STATUS",     REFRESH_STATUS, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_THREADS",    REFRESH_THREADS, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_SLAVE",      REFRESH_SLAVE, 
CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_MASTER",     REFRESH_MASTER, 
CONST_CS | CONST_PERSISTENT);
+#ifdef REFRESH_BACKUP_LOG
+       REGISTER_LONG_CONSTANT("MYSQLI_REFRESH_BACKUP_LOG", REFRESH_BACKUP_LOG, 
CONST_CS | CONST_PERSISTENT);
+#endif
+
        return SUCCESS;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.22.2.16.2.23&r2=1.118.2.22.2.16.2.24&diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.22.2.16.2.23 
php-src/ext/mysqli/mysqli_api.c:1.118.2.22.2.16.2.24
--- php-src/ext/mysqli/mysqli_api.c:1.118.2.22.2.16.2.23        Fri Jan  9 
14:30:00 2009
+++ php-src/ext/mysqli/mysqli_api.c     Thu Jan 22 21:01:56 2009
@@ -17,7 +17,7 @@
   |          Ulf Wendel <u...@php.net>                                     |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.118.2.22.2.16.2.23 2009/01/09 14:30:00 johannes Exp $ 
+  $Id: mysqli_api.c,v 1.118.2.22.2.16.2.24 2009/01/22 21:01:56 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -2068,6 +2068,22 @@
 }
 
 /* }}} */
+
+/* {{{ proto bool mysqli_refresh(object link, long options)
+   Flush tables or caches, or reset replication server information */
+PHP_FUNCTION(mysqli_refresh)
+{
+       MY_MYSQL *mysql;
+       zval *mysql_link = NULL;
+       long options;
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"Ol", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", 
MYSQLI_STATUS_INITIALIZED);
+       RETURN_BOOL(!mysql_refresh(mysql->mysql, options));
+}
+/* }}} */
  
 /* {{{ proto int mysqli_stmt_attr_set(object stmt, long attr, long mode)
 */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_fe.c?r1=1.49.2.5.2.1.2.13&r2=1.49.2.5.2.1.2.14&diff_format=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.49.2.5.2.1.2.13 
php-src/ext/mysqli/mysqli_fe.c:1.49.2.5.2.1.2.14
--- php-src/ext/mysqli/mysqli_fe.c:1.49.2.5.2.1.2.13    Mon Jan 12 14:04:32 2009
+++ php-src/ext/mysqli/mysqli_fe.c      Thu Jan 22 21:01:56 2009
@@ -15,7 +15,7 @@
   | Author: Georg Richter <ge...@php.net>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_fe.c,v 1.49.2.5.2.1.2.13 2009/01/12 14:04:32 johannes Exp $ 
+  $Id: mysqli_fe.c,v 1.49.2.5.2.1.2.14 2009/01/22 21:01:56 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -178,6 +178,8 @@
        PHP_FE(mysqli_use_result,                                               
        NULL)
        PHP_FE(mysqli_warning_count,                                            
NULL)
 
+       PHP_FE(mysqli_refresh,                                                  
NULL)
+
        /* Aliases */
        PHP_FALIAS(mysqli_bind_param,           mysqli_stmt_bind_param,         
third_arg_force_by_ref_rest)
        PHP_FALIAS(mysqli_bind_result,          mysqli_stmt_bind_result,        
second_arg_force_by_ref_rest)
@@ -252,6 +254,7 @@
        PHP_FALIAS(store_result,mysqli_store_result,NULL)
        PHP_FALIAS(thread_safe,mysqli_thread_safe,NULL)
        PHP_FALIAS(use_result,mysqli_use_result,NULL)
+       PHP_FALIAS(refresh,mysqli_refresh,NULL)
        {NULL, NULL, NULL}
 };
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/php_mysqli_structs.h?r1=1.4.2.17&r2=1.4.2.18&diff_format=u
Index: php-src/ext/mysqli/php_mysqli_structs.h
diff -u php-src/ext/mysqli/php_mysqli_structs.h:1.4.2.17 
php-src/ext/mysqli/php_mysqli_structs.h:1.4.2.18
--- php-src/ext/mysqli/php_mysqli_structs.h:1.4.2.17    Wed Dec 31 11:15:39 2008
+++ php-src/ext/mysqli/php_mysqli_structs.h     Thu Jan 22 21:01:56 2009
@@ -15,7 +15,7 @@
   | Author: Georg Richter <ge...@php.net>                                |
   +----------------------------------------------------------------------+
 
-  $Id: php_mysqli_structs.h,v 1.4.2.17 2008/12/31 11:15:39 sebastian Exp $ 
+  $Id: php_mysqli_structs.h,v 1.4.2.18 2009/01/22 21:01:56 johannes Exp $ 
 */
 
 #ifndef PHP_MYSQLI_STRUCTS_H
@@ -471,6 +471,7 @@
 PHP_FUNCTION(mysqli_sqlstate);
 PHP_FUNCTION(mysqli_ssl_set);
 PHP_FUNCTION(mysqli_stat);
+PHP_FUNCTION(mysqli_refresh);
 PHP_FUNCTION(mysqli_stmt_affected_rows);
 PHP_FUNCTION(mysqli_stmt_close);
 PHP_FUNCTION(mysqli_stmt_data_seek);
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt?r1=1.2.2.5&r2=1.2.2.6&diff_format=u
Index: php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
diff -u php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt:1.2.2.5 
php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt:1.2.2.6
--- php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt:1.2.2.5 Tue Nov 
18 17:02:18 2008
+++ php-src/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt Thu Jan 22 
21:01:56 2009
@@ -45,6 +45,7 @@
                'real_connect'                  => true,
                'real_escape_string'            => true,
                'real_query'                    => true,
+               'refresh'                       => true,
                'rollback'                      => true,
                'select_db'                     => true,
                'set_charset'                   => true,
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_constants.phpt?r1=1.2.2.6&r2=1.2.2.7&diff_format=u
Index: php-src/ext/mysqli/tests/mysqli_constants.phpt
diff -u php-src/ext/mysqli/tests/mysqli_constants.phpt:1.2.2.6 
php-src/ext/mysqli/tests/mysqli_constants.phpt:1.2.2.7
--- php-src/ext/mysqli/tests/mysqli_constants.phpt:1.2.2.6      Tue Nov 18 
17:02:18 2008
+++ php-src/ext/mysqli/tests/mysqli_constants.phpt      Thu Jan 22 21:01:58 2009
@@ -84,6 +84,14 @@
                "MYSQLI_REPORT_ERROR"                           => true,
                "MYSQLI_REPORT_OFF"                                     => true,
                "MYSQLI_SET_CHARSET_NAME"                       => true,
+               "MYSQLI_REFRESH_GRANT"                          => true,
+               "MYSQLI_REFRESH_LOG"                            => true,
+               "MYSQLI_REFRESH_TABLES"                         => true,
+               "MYSQLI_REFRESH_HOSTS"                          => true,
+               "MYSQLI_REFRESH_STATUS"                         => true,
+               "MYSQLI_REFRESH_THREADS"                        => true,
+               "MYSQLI_REFRESH_SLAVE"                          => true,
+               "MYSQLI_REFRESH_MASTER"                         => true,
        );
 
        /* depends on the build - experimental */
@@ -91,6 +99,10 @@
                $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true;
        }
 
+       if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) {
+               $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true;
+       }
+
        if ($IS_MYSQLND) {
                $version = 50007 + 1;
                $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true;
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_poll.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/mysqli/tests/mysqli_poll.phpt
diff -u php-src/ext/mysqli/tests/mysqli_poll.phpt:1.1.2.2 
php-src/ext/mysqli/tests/mysqli_poll.phpt:1.1.2.3
--- php-src/ext/mysqli/tests/mysqli_poll.phpt:1.1.2.2   Tue Nov 18 17:02:18 2008
+++ php-src/ext/mysqli/tests/mysqli_poll.phpt   Thu Jan 22 21:01:58 2009
@@ -28,28 +28,28 @@
        if (NULL !== ($tmp = @mysqli_poll()))
                printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
 
-       if (NULL !== ($tmp = @mysqli_poll(array($link))))
+       $l = array($link);
+       if (NULL !== ($tmp = @mysqli_poll($l)))
                printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
 
-       if (NULL !== ($tmp = @mysqli_poll(array($link), NULL)))
+       $l = array($link); $n = NULL;
+       if (NULL !== ($tmp = @mysqli_poll($l, $n)))
                printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
 
-       if (NULL !== ($tmp = @mysqli_poll(array($link), NULL, NULL)))
+       $l = array($link); $n = NULL;
+       if (NULL !== ($tmp = @mysqli_poll($l, $n, $n)))
                printf("[005] Expecting NULL got %s\n", var_export($tmp, true));
 
-       $int_val = 43;
-       $myerrors = &$int_val;
-
-       if (NULL !== ($tmp = @mysqli_poll(array($link), $myerrors, NULL, 1)))
-               printf("[006] Expecting NULL got %s\n", var_export($tmp, true));
-
-       if (NULL !== ($tmp = @mysqli_poll(array($link), NULL, NULL, -1)))
+       $l = array($link); $e = NULL; $r = NULL;
+       if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, -1)))
                printf("[007] Expecting boolean/false got %s/%s\n", 
gettype($tmp), var_export($tmp, true));
 
-       if (NULL !== ($tmp = @mysqli_poll(array($link), NULL, NULL, 0, -1)))
+       $l = array($link); $e = NULL; $r = NULL;
+       if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, 0, -1)))
                printf("[008] Expecting boolean/false got %s/%s\n", 
gettype($tmp), var_export($tmp, true));
 
-       if (0 !== ($tmp = (mysqli_poll(array($link), array($link), 
array($link), 0, 1))))
+       $read = $error = $reject = array($link);
+       if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1))))
                printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), 
var_export($tmp, true));
 
 

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

Reply via email to