Diff for /embedaddon/php/ext/mysqlnd/php_mysqlnd.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 23:47:58 version 1.1.1.2, 2012/05/29 12:34:41
Line 12 Line 12
   | obtain it through the world-wide-web, please send a note to          |    | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |    | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+    +----------------------------------------------------------------------+
  | Authors: Georg Richter <georg@mysql.com>                             |  | Authors: Andrey Hristov <andrey@mysql.com>                           |
  |          Andrey Hristov <andrey@mysql.com>                           | 
   |          Ulf Wendel <uwendel@mysql.com>                              |    |          Ulf Wendel <uwendel@mysql.com>                              |
     |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+    +----------------------------------------------------------------------+
 */  */
   
Line 24 Line 24
 #include "mysqlnd.h"  #include "mysqlnd.h"
 #include "mysqlnd_priv.h"  #include "mysqlnd_priv.h"
 #include "mysqlnd_debug.h"  #include "mysqlnd_debug.h"
   #include "mysqlnd_statistics.h"
   #include "mysqlnd_reverse_api.h"
 #include "ext/standard/info.h"  #include "ext/standard/info.h"
   #include "ext/standard/php_smart_str.h"
   
 /* {{{ mysqlnd_functions[]  /* {{{ mysqlnd_functions[]
  *   *
Line 92  PHPAPI void mysqlnd_minfo_print_hash(zval *values) Line 95  PHPAPI void mysqlnd_minfo_print_hash(zval *values)
 /* }}} */  /* }}} */
   
   
   /* {{{ mysqlnd_minfo_dump_plugin_stats */
   static int
   mysqlnd_minfo_dump_plugin_stats(void *pDest, void * argument TSRMLS_DC)
   {
           struct st_mysqlnd_plugin_header * plugin_header = *(struct st_mysqlnd_plugin_header **) pDest;
           if (plugin_header->plugin_stats.values) {
                   char buf[64];
                   zval values;
                   snprintf(buf, sizeof(buf), "%s statistics", plugin_header->plugin_name);
   
                   mysqlnd_fill_stats_hash(plugin_header->plugin_stats.values, plugin_header->plugin_stats.names, &values TSRMLS_CC ZEND_FILE_LINE_CC); 
   
                   php_info_print_table_start();
                   php_info_print_table_header(2, buf, "");
                   mysqlnd_minfo_print_hash(&values);
                   php_info_print_table_end();
                   zval_dtor(&values);
           }
           return ZEND_HASH_APPLY_KEEP;
   }
   /* }}} */
   
   
   /* {{{ mysqlnd_minfo_dump_loaded_plugins */
   static int 
   mysqlnd_minfo_dump_loaded_plugins(void *pDest, void * buf TSRMLS_DC)
   {
           smart_str * buffer = (smart_str *) buf;
           struct st_mysqlnd_plugin_header * plugin_header = *(struct st_mysqlnd_plugin_header **) pDest;
           if (plugin_header->plugin_name) {
                   if (buffer->len) {
                           smart_str_appendc(buffer, ',');
                   }
                   smart_str_appends(buffer, plugin_header->plugin_name);
           }
           return ZEND_HASH_APPLY_KEEP;
   }
   /* }}} */
   
   /* {{{ mysqlnd_minfo_dump_api_plugins */
   static int
   mysqlnd_minfo_dump_api_plugins(void * pDest, void * buf TSRMLS_DC)
   {
           smart_str * buffer = (smart_str *) buf;
           MYSQLND_REVERSE_API * ext = *(MYSQLND_REVERSE_API **) pDest;
           if (buffer->len) {
                   smart_str_appendc(buffer, ',');
           }
           smart_str_appends(buffer, ext->module->name);
           return ZEND_HASH_APPLY_KEEP;
   }
   /* }}} */
   
   
 /* {{{ PHP_MINFO_FUNCTION  /* {{{ PHP_MINFO_FUNCTION
  */   */
 PHP_MINFO_FUNCTION(mysqlnd)  PHP_MINFO_FUNCTION(mysqlnd)
 {  {
         char buf[32];          char buf[32];
         zval values;  
   
         php_info_print_table_start();          php_info_print_table_start();
         php_info_print_table_header(2, "mysqlnd", "enabled");          php_info_print_table_header(2, "mysqlnd", "enabled");
Line 124  PHP_MINFO_FUNCTION(mysqlnd) Line 180  PHP_MINFO_FUNCTION(mysqlnd)
         php_info_print_table_row(2, "Collecting memory statistics", MYSQLND_G(collect_memory_statistics)? "Yes":"No");          php_info_print_table_row(2, "Collecting memory statistics", MYSQLND_G(collect_memory_statistics)? "Yes":"No");
   
         php_info_print_table_row(2, "Tracing", MYSQLND_G(debug)? MYSQLND_G(debug):"n/a");          php_info_print_table_row(2, "Tracing", MYSQLND_G(debug)? MYSQLND_G(debug):"n/a");
         php_info_print_table_end();  
   
        /* Print client stats */        /* loaded plugins */
        php_info_print_table_start();        {
        php_info_print_table_header(2, "Client statistics", "");                smart_str tmp_str = {0, 0, 0};
        mysqlnd_get_client_stats(&values);                mysqlnd_plugin_apply_with_argument(mysqlnd_minfo_dump_loaded_plugins, &tmp_str);
        mysqlnd_minfo_print_hash(&values);                smart_str_0(&tmp_str);
                 php_info_print_table_row(2, "Loaded plugins", tmp_str.c);
                 smart_str_free(&tmp_str);
   
        zval_dtor(&values);                zend_hash_apply_with_argument(mysqlnd_reverse_api_get_api_list(TSRMLS_C), mysqlnd_minfo_dump_api_plugins, &tmp_str TSRMLS_CC);
                 smart_str_0(&tmp_str);
                 php_info_print_table_row(2, "API Extensions", tmp_str.c);
                 smart_str_free(&tmp_str);
         }
 
         php_info_print_table_end();          php_info_print_table_end();
   
   
           /* Print client stats */
           mysqlnd_plugin_apply_with_argument(mysqlnd_minfo_dump_plugin_stats, NULL);
 }  }
 /* }}} */  /* }}} */
   
Line 187  PHP_INI_BEGIN() Line 253  PHP_INI_BEGIN()
         STD_PHP_INI_ENTRY("mysqlnd.log_mask",                           "0",    PHP_INI_ALL,    OnUpdateLong,   log_mask, zend_mysqlnd_globals, mysqlnd_globals)          STD_PHP_INI_ENTRY("mysqlnd.log_mask",                           "0",    PHP_INI_ALL,    OnUpdateLong,   log_mask, zend_mysqlnd_globals, mysqlnd_globals)
         STD_PHP_INI_ENTRY("mysqlnd.mempool_default_size","16000",   PHP_INI_ALL,        OnUpdateLong,   mempool_default_size,   zend_mysqlnd_globals,           mysqlnd_globals)          STD_PHP_INI_ENTRY("mysqlnd.mempool_default_size","16000",   PHP_INI_ALL,        OnUpdateLong,   mempool_default_size,   zend_mysqlnd_globals,           mysqlnd_globals)
   
#ifdef PHP_DEBUG#if PHP_DEBUG
         STD_PHP_INI_ENTRY("mysqlnd.debug_emalloc_fail_threshold","-1",   PHP_INI_SYSTEM,        OnUpdateLong,   debug_emalloc_fail_threshold,   zend_mysqlnd_globals,           mysqlnd_globals)          STD_PHP_INI_ENTRY("mysqlnd.debug_emalloc_fail_threshold","-1",   PHP_INI_SYSTEM,        OnUpdateLong,   debug_emalloc_fail_threshold,   zend_mysqlnd_globals,           mysqlnd_globals)
         STD_PHP_INI_ENTRY("mysqlnd.debug_ecalloc_fail_threshold","-1",   PHP_INI_SYSTEM,        OnUpdateLong,   debug_ecalloc_fail_threshold,   zend_mysqlnd_globals,           mysqlnd_globals)          STD_PHP_INI_ENTRY("mysqlnd.debug_ecalloc_fail_threshold","-1",   PHP_INI_SYSTEM,        OnUpdateLong,   debug_ecalloc_fail_threshold,   zend_mysqlnd_globals,           mysqlnd_globals)
         STD_PHP_INI_ENTRY("mysqlnd.debug_erealloc_fail_threshold","-1",   PHP_INI_SYSTEM,       OnUpdateLong,   debug_erealloc_fail_threshold,  zend_mysqlnd_globals,           mysqlnd_globals)          STD_PHP_INI_ENTRY("mysqlnd.debug_erealloc_fail_threshold","-1",   PHP_INI_SYSTEM,       OnUpdateLong,   debug_erealloc_fail_threshold,  zend_mysqlnd_globals,           mysqlnd_globals)
Line 224  static PHP_MSHUTDOWN_FUNCTION(mysqlnd) Line 290  static PHP_MSHUTDOWN_FUNCTION(mysqlnd)
 /* }}} */  /* }}} */
   
   
#if defined(PHP_DEBUG)#if PHP_DEBUG
 /* {{{ PHP_RINIT_FUNCTION  /* {{{ PHP_RINIT_FUNCTION
  */   */
 static PHP_RINIT_FUNCTION(mysqlnd)  static PHP_RINIT_FUNCTION(mysqlnd)
 {  {
 #if defined(PHP_DEBUG)  
         if (MYSQLND_G(debug)) {          if (MYSQLND_G(debug)) {
                MYSQLND_DEBUG *dbg = mysqlnd_debug_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC);                struct st_mysqlnd_plugin_trace_log * trace_log_plugin = mysqlnd_plugin_find("debug_trace");
                if (!dbg) {                MYSQLND_G(dbg) = NULL;
                        return FAILURE;                if (trace_log_plugin) {
                         MYSQLND_DEBUG * dbg = trace_log_plugin->methods.trace_instance_init(mysqlnd_debug_std_no_trace_funcs TSRMLS_CC);
                         if (!dbg) {
                                 return FAILURE;
                         }
                         dbg->m->set_mode(dbg, MYSQLND_G(debug));
                         MYSQLND_G(dbg) = dbg;
                 }                  }
                 dbg->m->set_mode(dbg, MYSQLND_G(debug));  
                 MYSQLND_G(dbg) = dbg;  
         }          }
 #endif  
         return SUCCESS;          return SUCCESS;
 }  }
 /* }}} */  /* }}} */
 #endif  #endif
   
   
#if defined(PHP_DEBUG)#if PHP_DEBUG
 /* {{{ PHP_RSHUTDOWN_FUNCTION  /* {{{ PHP_RSHUTDOWN_FUNCTION
  */   */
 static PHP_RSHUTDOWN_FUNCTION(mysqlnd)  static PHP_RSHUTDOWN_FUNCTION(mysqlnd)
Line 279  zend_module_entry mysqlnd_module_entry = { Line 347  zend_module_entry mysqlnd_module_entry = {
         mysqlnd_functions,          mysqlnd_functions,
         PHP_MINIT(mysqlnd),          PHP_MINIT(mysqlnd),
         PHP_MSHUTDOWN(mysqlnd),          PHP_MSHUTDOWN(mysqlnd),
#if defined(PHP_DEBUG)#if PHP_DEBUG
         PHP_RINIT(mysqlnd),          PHP_RINIT(mysqlnd),
 #else  #else
         NULL,          NULL,
 #endif  #endif
#ifdef PHP_DEBUG#if PHP_DEBUG
         PHP_RSHUTDOWN(mysqlnd),          PHP_RSHUTDOWN(mysqlnd),
 #else  #else
         NULL,          NULL,

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>