andrey Mon, 11 Jan 2010 18:27:31 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=293417
Log: and another change to make the stats API re-usable Changed paths: U php/php-src/trunk/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-01-11 18:06:15 UTC (rev 293416) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-01-11 18:27:31 UTC (rev 293417) @@ -2029,7 +2029,7 @@ { DBG_ENTER("mysqlnd_conn::get_connection_stats"); DBG_INF_FMT("conn=%llu", conn->thread_id); - mysqlnd_fill_stats_hash(conn->stats, return_value TSRMLS_CC ZEND_FILE_LINE_CC); + mysqlnd_fill_stats_hash(conn->stats, mysqlnd_stats_values_names, return_value TSRMLS_CC ZEND_FILE_LINE_CC); DBG_VOID_RETURN; } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c 2010-01-11 18:06:15 UTC (rev 293416) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c 2010-01-11 18:27:31 UTC (rev 293417) @@ -190,13 +190,13 @@ /* {{{ mysqlnd_fill_stats_hash */ -void -mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC) +PHPAPI void +mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING * names, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC) { unsigned int i; - mysqlnd_array_init(return_value, STAT_LAST); - for (i = 0; i < STAT_LAST; i++) { + mysqlnd_array_init(return_value, stats->count); + for (i = 0; i < stats->count; i++) { #if PHP_MAJOR_VERSION >= 6 UChar *ustr, *tstr; int ulen, tlen; @@ -205,15 +205,13 @@ sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]); #if PHP_MAJOR_VERSION >= 6 - zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysqlnd_stats_values_names[i].s, - mysqlnd_stats_values_names[i].l + 1 TSRMLS_CC); + zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, names[i].s, names[i].l + 1 TSRMLS_CC); zend_string_to_unicode(UG(utf8_conv), &tstr, &tlen, tmp, strlen(tmp) + 1 TSRMLS_CC); add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1); efree(ustr); efree(tstr); #else - add_assoc_string_ex(return_value, mysqlnd_stats_values_names[i].s, - mysqlnd_stats_values_names[i].l + 1, tmp, 1); + add_assoc_string_ex(return_value, names[i].s, names[i].l + 1, tmp, 1); #endif } } @@ -229,7 +227,7 @@ memset(&stats, 0, sizeof(stats)); stats_ptr = &stats; } - mysqlnd_fill_stats_hash(stats_ptr, return_value TSRMLS_CC ZEND_FILE_LINE_CC); + mysqlnd_fill_stats_hash(stats_ptr, mysqlnd_stats_values_names, return_value TSRMLS_CC ZEND_FILE_LINE_CC); DBG_VOID_RETURN; } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h 2010-01-11 18:06:15 UTC (rev 293416) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h 2010-01-11 18:27:31 UTC (rev 293417) @@ -163,10 +163,8 @@ MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), (conn_stats), (statistic1), (value1), (statistic2), (value2), (statistic3), (value3)); -void mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, zval *return_value - TSRMLS_DC ZEND_FILE_LINE_DC); +PHPAPI void mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const MYSQLND_STRING * names, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); - PHPAPI void mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count); PHPAPI void mysqlnd_stats_end(MYSQLND_STATS * stats);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php