~legolas/ubuntu/natty/php5/5.3.5

« back to all changes in this revision

Viewing changes to ext/mysqlnd/mysqlnd_statistics.c

  • Committer: Stas Verberkt
  • Date: 2011-02-01 09:27:15 UTC
  • Revision ID: legolas@legolasweb.nl-20110201092715-yq052iu2yl4i2eyg
Inserted PHP 5.3.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
  +----------------------------------------------------------------------+
19
19
*/
20
20
 
21
 
/* $Id: mysqlnd_statistics.c 298217 2010-04-20 13:50:34Z felipe $ */
 
21
/* $Id: mysqlnd_statistics.c 305109 2010-11-05 20:07:34Z andrey $ */
22
22
#include "php.h"
23
23
#include "mysqlnd.h"
24
24
#include "mysqlnd_priv.h"
190
190
        { STR_W_LEN("com_stmt_reset") },
191
191
        { STR_W_LEN("com_stmt_set_option") },
192
192
        { STR_W_LEN("com_stmt_fetch") },
193
 
        { STR_W_LEN("com_deamon") }
 
193
        { STR_W_LEN("com_deamon") },
 
194
        { STR_W_LEN("bytes_received_real_data_normal") },
 
195
        { STR_W_LEN("bytes_received_real_data_ps") }
194
196
};
195
197
/* }}} */
196
198
 
203
205
 
204
206
        mysqlnd_array_init(return_value, stats->count);
205
207
        for (i = 0; i < stats->count; i++) {
206
 
#if PHP_MAJOR_VERSION >= 6
 
208
#if MYSQLND_UNICODE
207
209
                UChar *ustr, *tstr;
208
210
                int ulen, tlen;
209
211
#endif
210
212
                char tmp[25];
211
 
                
 
213
 
212
214
                sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
213
 
#if PHP_MAJOR_VERSION >= 6
 
215
#if MYSQLND_UNICODE
214
216
                zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, names[i].s, names[i].l + 1 TSRMLS_CC);
215
217
                zend_string_to_unicode(UG(utf8_conv), &tstr, &tlen, tmp, strlen(tmp) + 1 TSRMLS_CC);
216
218
                add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1);
274
276
 
275
277
/* {{{ mysqlnd_stats_set_trigger */
276
278
PHPAPI mysqlnd_stat_trigger
277
 
mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger TSRMLS_DC)
 
279
mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, enum_mysqlnd_collected_stats statistic, mysqlnd_stat_trigger trigger TSRMLS_DC)
278
280
{
279
281
        mysqlnd_stat_trigger ret = NULL;
280
282
        DBG_ENTER("mysqlnd_stats_set_trigger");
281
283
        if (stats) {
282
284
                MYSQLND_STATS_LOCK(stats);
283
 
                ret = stats->triggers[stat];
284
 
                stats->triggers[stat] = trigger;
 
285
                ret = stats->triggers[statistic];
 
286
                stats->triggers[statistic] = trigger;
285
287
                MYSQLND_STATS_UNLOCK(stats);
286
288
        }
287
289
        DBG_RETURN(ret);