/* {{{ 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;
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
}
}
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;
}
/* }}} */
DBG_ENTER("mysqlnd_stats_reset_trigger");
if (stats) {
MYSQLND_STATS_LOCK(stats);
- memset(stats->triggers, 0, STAT_LAST * sizeof(mysqlnd_stat_trigger));
+ memset(stats->triggers, 0, stats->count * sizeof(mysqlnd_stat_trigger));
MYSQLND_STATS_UNLOCK(stats);
}
DBG_RETURN(ret);
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);