- More statistics
- Fixed endless loop - mysqlnd_stmt_next_result() returned FAIL but as it
  is defined to be 1 (and PASS is 0), checking for mysqlnd_stmt_more_result()
  was successful although we were expecting a FAIL.
This commit is contained in:
Andrey Hristov 2008-09-12 15:08:41 +00:00
parent 343d958b25
commit 99ea8068df
6 changed files with 339 additions and 75 deletions

View File

@ -683,7 +683,7 @@ void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
if (MYSQLND_G(collect_memory_statistics)) {
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(STAT_MEM_EMALLOC_COUNT, 1, STAT_MEM_EMALLOC_AMMOUNT, size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT, 1, STAT_MEM_EMALLOC_AMMOUNT, size);
}
DBG_RETURN(ret);
}
@ -710,7 +710,7 @@ void * _mysqlnd_pemalloc(size_t size, zend_bool persistent MYSQLND_MEM_D)
if (MYSQLND_G(collect_memory_statistics)) {
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? STAT_MEM_MALLOC_AMMOUNT:STAT_MEM_EMALLOC_AMMOUNT;
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(s1, 1, s2, size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}
DBG_RETURN(ret);
@ -736,7 +736,7 @@ void * _mysqlnd_ecalloc(uint nmemb, size_t size MYSQLND_MEM_D)
DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
if (MYSQLND_G(collect_memory_statistics)) {
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(STAT_MEM_ECALLOC_COUNT, 1, STAT_MEM_ECALLOC_AMMOUNT, size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 1, STAT_MEM_ECALLOC_AMMOUNT, size);
}
DBG_RETURN(ret);
}
@ -763,7 +763,7 @@ void * _mysqlnd_pecalloc(uint nmemb, size_t size, zend_bool persistent MYSQLND_M
if (MYSQLND_G(collect_memory_statistics)) {
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? STAT_MEM_CALLOC_AMMOUNT:STAT_MEM_ECALLOC_AMMOUNT;
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(s1, 1, s2, size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}
DBG_RETURN(ret);
@ -790,7 +790,7 @@ void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
DBG_INF_FMT("new_ptr=%p", ret);
if (MYSQLND_G(collect_memory_statistics)) {
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(STAT_MEM_EREALLOC_COUNT, 1, STAT_MEM_EREALLOC_AMMOUNT, new_size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT, 1, STAT_MEM_EREALLOC_AMMOUNT, new_size);
}
DBG_RETURN(ret);
}
@ -819,7 +819,7 @@ void * _mysqlnd_perealloc(void *ptr, size_t new_size, zend_bool persistent MYSQL
if (MYSQLND_G(collect_memory_statistics)) {
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? STAT_MEM_REALLOC_AMMOUNT:STAT_MEM_EREALLOC_AMMOUNT;
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(s1, 1, s2, new_size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size);
}
DBG_RETURN(ret);
}
@ -881,7 +881,7 @@ void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D)
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
if (MYSQLND_G(collect_memory_statistics)) {
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMMOUNT, size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMMOUNT, size);
}
DBG_RETURN(ret);
}
@ -899,7 +899,7 @@ void * _mysqlnd_calloc(uint nmemb, size_t size MYSQLND_MEM_D)
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
if (MYSQLND_G(collect_memory_statistics)) {
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMMOUNT, size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMMOUNT, size);
}
DBG_RETURN(ret);
}
@ -920,7 +920,7 @@ void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D)
DBG_INF_FMT("new_ptr=%p", ret);
if (MYSQLND_G(collect_memory_statistics)) {
MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(STAT_MEM_REALLOC_COUNT, 1, STAT_MEM_REALLOC_AMMOUNT, new_size);
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_REALLOC_COUNT, 1, STAT_MEM_REALLOC_AMMOUNT, new_size);
}
DBG_RETURN(ret);
}

View File

@ -303,6 +303,7 @@ typedef enum mysqlnd_connection_close_type
MYSQLND_CLOSE_LAST /* for checking, should always be last */
} enum_connection_close_type;
typedef enum mysqlnd_collected_stats
{
STAT_BYTES_SENT,
@ -311,6 +312,21 @@ typedef enum mysqlnd_collected_stats
STAT_PACKETS_RECEIVED,
STAT_PROTOCOL_OVERHEAD_IN,
STAT_PROTOCOL_OVERHEAD_OUT,
STAT_BYTES_RECEIVED_OK,
STAT_BYTES_RECEIVED_EOF,
STAT_BYTES_RECEIVED_RSET_HEADER,
STAT_BYTES_RECEIVED_RSET_FIELD_META,
STAT_BYTES_RECEIVED_RSET_ROW,
STAT_BYTES_RECEIVED_PREPARE_RESPONSE,
STAT_BYTES_RECEIVED_CHANGE_USER,
STAT_PACKETS_SENT_CMD,
STAT_PACKETS_RECEIVED_OK,
STAT_PACKETS_RECEIVED_EOF,
STAT_PACKETS_RECEIVED_RSET_HEADER,
STAT_PACKETS_RECEIVED_RSET_FIELD_META,
STAT_PACKETS_RECEIVED_RSET_ROW,
STAT_PACKETS_RECEIVED_PREPARE_RESPONSE,
STAT_PACKETS_RECEIVED_CHANGE_USER,
STAT_RSET_QUERY,
STAT_NON_RSET_QUERY,
STAT_NO_INDEX_USED,
@ -367,6 +383,48 @@ typedef enum mysqlnd_collected_stats
STAT_MEM_REALLOC_COUNT,
STAT_MEM_REALLOC_AMMOUNT,
STAT_MEM_FREE_COUNT,
STAT_TEXT_TYPE_FETCHED_NULL,
STAT_TEXT_TYPE_FETCHED_BIT,
STAT_TEXT_TYPE_FETCHED_INT8,
STAT_TEXT_TYPE_FETCHED_INT16,
STAT_TEXT_TYPE_FETCHED_INT24,
STAT_TEXT_TYPE_FETCHED_INT32,
STAT_TEXT_TYPE_FETCHED_INT64,
STAT_TEXT_TYPE_FETCHED_DECIMAL,
STAT_TEXT_TYPE_FETCHED_FLOAT,
STAT_TEXT_TYPE_FETCHED_DOUBLE,
STAT_TEXT_TYPE_FETCHED_DATE,
STAT_TEXT_TYPE_FETCHED_YEAR,
STAT_TEXT_TYPE_FETCHED_TIME,
STAT_TEXT_TYPE_FETCHED_DATETIME,
STAT_TEXT_TYPE_FETCHED_TIMESTAMP,
STAT_TEXT_TYPE_FETCHED_STRING,
STAT_TEXT_TYPE_FETCHED_BLOB,
STAT_TEXT_TYPE_FETCHED_ENUM,
STAT_TEXT_TYPE_FETCHED_SET,
STAT_TEXT_TYPE_FETCHED_GEOMETRY,
STAT_TEXT_TYPE_FETCHED_OTHER,
STAT_BINARY_TYPE_FETCHED_NULL,
STAT_BINARY_TYPE_FETCHED_BIT,
STAT_BINARY_TYPE_FETCHED_INT8,
STAT_BINARY_TYPE_FETCHED_INT16,
STAT_BINARY_TYPE_FETCHED_INT24,
STAT_BINARY_TYPE_FETCHED_INT32,
STAT_BINARY_TYPE_FETCHED_INT64,
STAT_BINARY_TYPE_FETCHED_DECIMAL,
STAT_BINARY_TYPE_FETCHED_FLOAT,
STAT_BINARY_TYPE_FETCHED_DOUBLE,
STAT_BINARY_TYPE_FETCHED_DATE,
STAT_BINARY_TYPE_FETCHED_YEAR,
STAT_BINARY_TYPE_FETCHED_TIME,
STAT_BINARY_TYPE_FETCHED_DATETIME,
STAT_BINARY_TYPE_FETCHED_TIMESTAMP,
STAT_BINARY_TYPE_FETCHED_STRING,
STAT_BINARY_TYPE_FETCHED_BLOB,
STAT_BINARY_TYPE_FETCHED_ENUM,
STAT_BINARY_TYPE_FETCHED_SET,
STAT_BINARY_TYPE_FETCHED_GEOMETRY,
STAT_BINARY_TYPE_FETCHED_OTHER,
STAT_LAST /* Should be always the last */
} enum_mysqlnd_collected_stats;

View File

@ -2009,7 +2009,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, net_close)(MYSQLND_STMT * const stmt, zend_
DBG_INF("skipping result");
stmt->result->m.skip_result(stmt->result TSRMLS_CC);
}
} while (mysqlnd_stmt_more_results(stmt) && mysqlnd_stmt_next_result(stmt));
} while (mysqlnd_stmt_more_results(stmt) && mysqlnd_stmt_next_result(stmt) == PASS);
/*
After this point we are allowed to free the result set,
as we have cleaned the line

View File

@ -30,6 +30,7 @@
/* {{{ mysqlnd_stats_values_names
*/
const MYSQLND_STRING mysqlnd_stats_values_names[STAT_LAST] =
{
{ STR_W_LEN("bytes_sent") },
@ -38,6 +39,21 @@ const MYSQLND_STRING mysqlnd_stats_values_names[STAT_LAST] =
{ STR_W_LEN("packets_received") },
{ STR_W_LEN("protocol_overhead_in") },
{ STR_W_LEN("protocol_overhead_out") },
{ STR_W_LEN("bytes_received_ok_packet") },
{ STR_W_LEN("bytes_received_eof_packet") },
{ STR_W_LEN("bytes_received_rset_header_packet") },
{ STR_W_LEN("bytes_received_rset_field_meta_packet") },
{ STR_W_LEN("bytes_received_rset_row_packet") },
{ STR_W_LEN("bytes_received_prepare_response_packet") },
{ STR_W_LEN("bytes_received_change_user_packet") },
{ STR_W_LEN("packets_sent_command") },
{ STR_W_LEN("packets_received_ok") },
{ STR_W_LEN("packets_received_eof") },
{ STR_W_LEN("packets_received_rset_header") },
{ STR_W_LEN("packets_received_rset_field_meta") },
{ STR_W_LEN("packets_received_rset_row") },
{ STR_W_LEN("packets_received_prepare_response") },
{ STR_W_LEN("packets_received_change_user") },
{ STR_W_LEN("result_set_queries") },
{ STR_W_LEN("non_result_set_queries") },
{ STR_W_LEN("no_index_used") },
@ -93,7 +109,49 @@ const MYSQLND_STRING mysqlnd_stats_values_names[STAT_LAST] =
{ STR_W_LEN("mem_calloc_ammount") },
{ STR_W_LEN("mem_realloc_calloc") },
{ STR_W_LEN("mem_realloc_ammount") },
{ STR_W_LEN("mem_free_count") }
{ STR_W_LEN("mem_free_count") },
{ STR_W_LEN("proto_text_fetched_null") },
{ STR_W_LEN("proto_text_fetched_bit") },
{ STR_W_LEN("proto_text_fetched_tinyint") },
{ STR_W_LEN("proto_text_fetched_short") },
{ STR_W_LEN("proto_text_fetched_int24") },
{ STR_W_LEN("proto_text_fetched_int") },
{ STR_W_LEN("proto_text_fetched_bigint") },
{ STR_W_LEN("proto_text_fetched_decimal") },
{ STR_W_LEN("proto_text_fetched_float") },
{ STR_W_LEN("proto_text_fetched_double") },
{ STR_W_LEN("proto_text_fetched_date") },
{ STR_W_LEN("proto_text_fetched_year") },
{ STR_W_LEN("proto_text_fetched_time") },
{ STR_W_LEN("proto_text_fetched_datetime") },
{ STR_W_LEN("proto_text_fetched_timestamp") },
{ STR_W_LEN("proto_text_fetched_string") },
{ STR_W_LEN("proto_text_fetched_blob") },
{ STR_W_LEN("proto_text_fetched_enum") },
{ STR_W_LEN("proto_text_fetched_set") },
{ STR_W_LEN("proto_text_fetched_geometry") },
{ STR_W_LEN("proto_text_fetched_other") },
{ STR_W_LEN("proto_binary_fetched_null") },
{ STR_W_LEN("proto_binary_fetched_bit") },
{ STR_W_LEN("proto_binary_fetched_tinyint") },
{ STR_W_LEN("proto_binary_fetched_short") },
{ STR_W_LEN("proto_binary_fetched_int24") },
{ STR_W_LEN("proto_binary_fetched_int") },
{ STR_W_LEN("proto_binary_fetched_bigint") },
{ STR_W_LEN("proto_binary_fetched_decimal") },
{ STR_W_LEN("proto_binary_fetched_float") },
{ STR_W_LEN("proto_binary_fetched_double") },
{ STR_W_LEN("proto_binary_fetched_date") },
{ STR_W_LEN("proto_binary_fetched_year") },
{ STR_W_LEN("proto_binary_fetched_time") },
{ STR_W_LEN("proto_binary_fetched_datetime") },
{ STR_W_LEN("proto_binary_fetched_timestamp") },
{ STR_W_LEN("proto_binary_fetched_string") },
{ STR_W_LEN("proto_binary_fetched_blob") },
{ STR_W_LEN("proto_binary_fetched_enum") },
{ STR_W_LEN("proto_binary_fetched_set") },
{ STR_W_LEN("proto_binary_fetched_geometry") },
{ STR_W_LEN("proto_binary_fetched_other") }
};
/* }}} */

View File

@ -38,7 +38,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
{ \
if (MYSQLND_G(collect_statistics)) { \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
DBG_INF_FMT("Global stat increase [%s]", mysqlnd_stats_values_names[statistic]); \
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
mysqlnd_global_stats->values[(statistic)]++; \
@ -46,20 +46,9 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
}\
}
#define MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(statistic1, value1, statistic2, value2) \
{ \
if (MYSQLND_G(collect_statistics)) { \
DBG_INF_FMT("Global stats increase w value [%s] [%s]", mysqlnd_stats_values_names[statistic1], mysqlnd_stats_values_names[statistic2]); \
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
mysqlnd_global_stats->values[(statistic1)] += (value1); \
mysqlnd_global_stats->values[(statistic2)] += (value2); \
tsrm_mutex_unlock(mysqlnd_global_stats->LOCK_access); \
}\
}
#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (MYSQLND_G(collect_statistics)) { \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
DBG_INF_FMT("Global&conn stat decrease [%s]", mysqlnd_stats_values_names[statistic]); \
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
mysqlnd_global_stats->values[(statistic)]--; \
@ -70,9 +59,23 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
}\
}
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
#define MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(statistic1, value1, statistic2, value2) \
{ \
if (MYSQLND_G(collect_statistics)) { \
DBG_INF_FMT("Global stat increase [%s] [%s]", mysqlnd_stats_values_names[statistic1], mysqlnd_stats_values_names[statistic2]); \
uint64 v1 = (uint64) (value1); \
uint64 v2 = (uint64) (value2); \
\
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
if (statistic1 != STAT_LAST) mysqlnd_global_stats->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) mysqlnd_global_stats->values[(statistic2)]+= v2; \
tsrm_mutex_unlock(mysqlnd_global_stats->LOCK_access); \
}\
}
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
DBG_INF_FMT("Global&Conn stat increase [%s]", mysqlnd_stats_values_names[statistic]); \
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
mysqlnd_global_stats->values[(statistic)]++; \
@ -85,7 +88,7 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \
{ \
if (MYSQLND_G(collect_statistics)) { \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
uint64 v = (uint64) (value); \
DBG_INF_FMT("Global&Conn stat increase w value [%s]", mysqlnd_stats_values_names[statistic]); \
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
@ -97,22 +100,40 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
}\
}
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn_stats, statistic1, value1, statistic2, value2) \
{ \
if (MYSQLND_G(collect_statistics)) { \
uint64 v1 = (uint64) (value1); \
uint64 v2 = (uint64) (value2); \
\
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
if (statistic1 != STAT_LAST) mysqlnd_global_stats->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) mysqlnd_global_stats->values[(statistic2)]+= v2; \
tsrm_mutex_unlock(mysqlnd_global_stats->LOCK_access); \
if ((conn_stats)) { \
((MYSQLND_STATS *) conn_stats)->values[(statistic1)]+= v1; \
((MYSQLND_STATS *) conn_stats)->values[(statistic2)]+= v2; \
} \
} \
}
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \
{ \
if (MYSQLND_G(collect_statistics)) { \
uint64 v1 = (uint64) (value1); \
uint64 v2 = (uint64) (value2); \
uint64 v3 = (uint64) (value3); \
\
\
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
mysqlnd_global_stats->values[(statistic1)]+= v1; \
mysqlnd_global_stats->values[(statistic2)]+= v2; \
mysqlnd_global_stats->values[(statistic3)]+= v3; \
if (statistic1 != STAT_LAST) mysqlnd_global_stats->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) mysqlnd_global_stats->values[(statistic2)]+= v2; \
if (statistic3 != STAT_LAST) mysqlnd_global_stats->values[(statistic3)]+= v3; \
tsrm_mutex_unlock(mysqlnd_global_stats->LOCK_access); \
if ((conn_stats)) { \
((MYSQLND_STATS *) conn_stats)->values[(statistic1)]+= v1; \
((MYSQLND_STATS *) conn_stats)->values[(statistic2)]+= v2; \
((MYSQLND_STATS *) conn_stats)->values[(statistic3)]+= v3; \
if (statistic1 != STAT_LAST) ((MYSQLND_STATS *) conn_stats)->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) ((MYSQLND_STATS *) conn_stats)->values[(statistic2)]+= v2; \
if (statistic3 != STAT_LAST) ((MYSQLND_STATS *) conn_stats)->values[(statistic3)]+= v3; \
} \
} \
}
@ -122,26 +143,16 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
{ \
if (MYSQLND_G(collect_statistics)) { \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
DBG_INF_FMT("Global stat increase [%s]", mysqlnd_stats_values_names[statistic]); \
mysqlnd_global_stats->values[(statistic)]++; \
} \
}
#define MYSQLND_INC_GLOBAL_STATISTIC2_W_VALUE(statistic1, value1, statistic2, value2) \
{ \
if (MYSQLND_G(collect_statistics)) { \
DBG_INF_FMT("Global stats increase w value [%s] [%s]", \
mysqlnd_stats_values_names[statistic1], mysqlnd_stats_values_names[statistic2]); \
mysqlnd_global_stats->values[(statistic1)] += (value1); \
mysqlnd_global_stats->values[(statistic2)] += (value2); \
}\
}
#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (MYSQLND_G(collect_statistics)) { \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
DBG_INF_FMT("Global&Conn stat decrease [%s]", mysqlnd_stats_values_names[statistic]); \
mysqlnd_global_stats->values[(statistic)]--; \
if ((conn_stats)) { \
@ -150,9 +161,21 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
} \
}
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
#define MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(statistic1, value1, statistic2, value2) \
{ \
if (MYSQLND_G(collect_statistics)) { \
DBG_INF_FMT("Global stat increase [%s] [%s]", mysqlnd_stats_values_names[statistic1], mysqlnd_stats_values_names[statistic2]); \
uint64 v1 = (uint64) (value1); \
uint64 v2 = (uint64) (value2); \
\
if (statistic1 != STAT_LAST) mysqlnd_global_stats->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) mysqlnd_global_stats->values[(statistic2)]+= v2; \
}\
}
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
DBG_INF_FMT("Global&Conn stat increase [%s]", mysqlnd_stats_values_names[statistic]); \
mysqlnd_global_stats->values[(statistic)]++; \
if ((conn_stats)) { \
@ -163,9 +186,9 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value) \
{ \
uint64 v = (uint64) (value); \
DBG_INF_FMT("Global&Conn stats increase w value [%s]", mysqlnd_stats_values_names[statistic]); \
if (MYSQLND_G(collect_statistics)) { \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
uint64 v = (uint64) (value); \
DBG_INF_FMT("Global&Conn stats increase w value [%s]", mysqlnd_stats_values_names[statistic]); \
mysqlnd_global_stats->values[(statistic)] += v; \
if ((conn_stats)) { \
((MYSQLND_STATS *) conn_stats)->values[(statistic)] += v; \
@ -173,6 +196,21 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
} \
}
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn_stats, statistic1, value1, statistic2, value2) \
{ \
if (MYSQLND_G(collect_statistics)) { \
uint64 v1 = (uint64) (value1); \
uint64 v2 = (uint64) (value2); \
\
if (statistic1 != STAT_LAST) mysqlnd_global_stats->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) mysqlnd_global_stats->values[(statistic2)]+= v2; \
if ((conn_stats)) { \
((MYSQLND_STATS *) conn_stats)->values[(statistic1)]+= v1; \
((MYSQLND_STATS *) conn_stats)->values[(statistic2)]+= v2; \
} \
} \
}
#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, statistic2, value2, statistic3, value3) \
{ \
if (MYSQLND_G(collect_statistics)) { \
@ -180,13 +218,13 @@ extern const MYSQLND_STRING mysqlnd_stats_values_names[];
uint64 v2 = (uint64) (value2); \
uint64 v3 = (uint64) (value3); \
\
mysqlnd_global_stats->values[(statistic1)]+= v1; \
mysqlnd_global_stats->values[(statistic2)]+= v2; \
mysqlnd_global_stats->values[(statistic3)]+= v3; \
if (statistic1 != STAT_LAST) mysqlnd_global_stats->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) mysqlnd_global_stats->values[(statistic2)]+= v2; \
if (statistic3 != STAT_LAST) mysqlnd_global_stats->values[(statistic3)]+= v3; \
if ((conn_stats)) { \
((MYSQLND_STATS *) conn_stats)->values[(statistic1)]+= v1; \
((MYSQLND_STATS *) conn_stats)->values[(statistic2)]+= v2; \
((MYSQLND_STATS *) conn_stats)->values[(statistic3)]+= v3; \
if (statistic1 != STAT_LAST) ((MYSQLND_STATS *) conn_stats)->values[(statistic1)]+= v1; \
if (statistic2 != STAT_LAST) ((MYSQLND_STATS *) conn_stats)->values[(statistic2)]+= v2; \
if (statistic3 != STAT_LAST) ((MYSQLND_STATS *) conn_stats)->values[(statistic3)]+= v3; \
} \
} \
}

View File

@ -44,13 +44,13 @@
#define MYSQLND_DUMP_HEADER_N_BODY_FULL2
#define PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_size, packet_type) \
#define PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_size, packet_type_as_text, packet_type) \
{ \
if (FAIL == mysqlnd_read_header((conn), &((packet)->header) TSRMLS_CC)) {\
CONN_SET_STATE(conn, CONN_QUIT_SENT); \
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);\
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysqlnd_server_gone); \
DBG_ERR_FMT("Can't read %s's header", (packet_type)); \
DBG_ERR_FMT("Can't read %s's header", (packet_type_as_text)); \
DBG_RETURN(FAIL);\
}\
if ((buf_size) < (packet)->header.size) { \
@ -62,9 +62,13 @@
CONN_SET_STATE(conn, CONN_QUIT_SENT); \
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);\
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysqlnd_server_gone); \
DBG_ERR_FMT("Empty %s packet body", (packet_type)); \
DBG_ERR_FMT("Empty %s packet body", (packet_type_as_text)); \
DBG_RETURN(FAIL);\
} \
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, packet_type_to_statistic_byte_count[packet_type], \
MYSQLND_HEADER_SIZE + (packet)->header.size, \
packet_type_to_statistic_packet_count[packet_type], \
1); \
}
@ -76,7 +80,7 @@ char * const mysqlnd_empty_string = "";
/* Used in mysqlnd_debug.c */
char * mysqlnd_read_header_name = "mysqlnd_read_header";
char * mysqlnd_read_body_name = "mysqlnd_read_body";
char * mysqlnd_read_body_name = "mysqlnd_read_body";
/* {{{ mysqlnd_command_to_text
@ -94,6 +98,36 @@ const char * const mysqlnd_command_to_text[COM_END] =
/* }}} */
static enum_mysqlnd_collected_stats packet_type_to_statistic_byte_count[PROT_LAST] =
{
STAT_LAST,
STAT_LAST,
STAT_BYTES_RECEIVED_OK,
STAT_BYTES_RECEIVED_EOF,
STAT_LAST,
STAT_BYTES_RECEIVED_RSET_HEADER,
STAT_BYTES_RECEIVED_RSET_FIELD_META,
STAT_BYTES_RECEIVED_RSET_ROW,
STAT_BYTES_RECEIVED_PREPARE_RESPONSE,
STAT_BYTES_RECEIVED_CHANGE_USER,
};
static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_LAST] =
{
STAT_LAST,
STAT_LAST,
STAT_PACKETS_RECEIVED_OK,
STAT_PACKETS_RECEIVED_EOF,
STAT_LAST,
STAT_PACKETS_RECEIVED_RSET_HEADER,
STAT_PACKETS_RECEIVED_RSET_FIELD_META,
STAT_PACKETS_RECEIVED_RSET_ROW,
STAT_PACKETS_RECEIVED_PREPARE_RESPONSE,
STAT_PACKETS_RECEIVED_CHANGE_USER,
};
/* {{{ php_mysqlnd_net_field_length
Get next field's length */
unsigned long php_mysqlnd_net_field_length(zend_uchar **packet)
@ -313,7 +347,7 @@ size_t mysqlnd_stream_write_w_header(MYSQLND * const conn, char * const buf, siz
while (left > MYSQLND_MAX_PACKET_SIZE) {
STORE_HEADER_SIZE(safe_storage, p);
int3store(p, MYSQLND_MAX_PACKET_SIZE);
int1store(p + 3, net->packet_no);
int1store(p + 3, net->packet_no);
net->packet_no++;
ret = php_stream_write(net->stream, (char *)p, MYSQLND_MAX_PACKET_SIZE + MYSQLND_HEADER_SIZE);
RESTORE_HEADER_SIZE(p, safe_storage);
@ -326,7 +360,7 @@ size_t mysqlnd_stream_write_w_header(MYSQLND * const conn, char * const buf, siz
/* Even for zero size payload we have to send a packet */
STORE_HEADER_SIZE(safe_storage, p);
int3store(p, left);
int1store(p + 3, net->packet_no);
int1store(p + 3, net->packet_no);
net->packet_no++;
ret = php_stream_write(net->stream, (char *)p, left + MYSQLND_HEADER_SIZE);
RESTORE_HEADER_SIZE(p, safe_storage);
@ -335,7 +369,7 @@ size_t mysqlnd_stream_write_w_header(MYSQLND * const conn, char * const buf, siz
DBG_ERR_FMT("Can't %u send bytes", count);
conn->state = CONN_QUIT_SENT;
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
}
}
MYSQLND_INC_CONN_STATISTIC_W_VALUE3(&conn->stats,
STAT_BYTES_SENT, count + packets_sent * MYSQLND_HEADER_SIZE,
@ -371,12 +405,12 @@ size_t mysqlnd_stream_write_w_command(MYSQLND * const conn, enum php_mysqlnd_ser
setsockopt(((php_netstream_data_t*)net->stream->abstract)->socket,
IPPROTO_TCP, TCP_CORK, &corked, sizeof(corked));
int1store(safe_storage + MYSQLND_HEADER_SIZE, command);
int1store(safe_storage + MYSQLND_HEADER_SIZE, command);
while (left > MYSQLND_MAX_PACKET_SIZE) {
size_t body_size = MYSQLND_MAX_PACKET_SIZE;
int3store(safe_storage, MYSQLND_MAX_PACKET_SIZE);
int1store(safe_storage + 3, net->packet_no);
int1store(safe_storage + 3, net->packet_no);
net->packet_no++;
ret = php_stream_write(net->stream, (char *)safe_storage, header_len);
@ -534,7 +568,7 @@ php_mysqlnd_greet_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_greet_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "greeting");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "greeting", PROT_GREET_PACKET);
packet->protocol_version = uint1korr(p);
p++;
@ -551,7 +585,7 @@ php_mysqlnd_greet_read(void *_packet, MYSQLND *conn TSRMLS_DC)
*/
if (packet->error_no == 1040) {
memcpy(packet->sqlstate, "08004", MYSQLND_SQLSTATE_LENGTH);
}
}
DBG_RETURN(PASS);
}
@ -582,7 +616,7 @@ php_mysqlnd_greet_read(void *_packet, MYSQLND *conn TSRMLS_DC)
if (p - buf < packet->header.size) {
/* scramble_buf is split into two parts */
memcpy(packet->scramble_buf + SCRAMBLE_LENGTH_323,
p, SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323);
p, SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323);
} else {
packet->pre41 = TRUE;
}
@ -755,7 +789,7 @@ php_mysqlnd_ok_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_ok_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "OK");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "OK", PROT_OK_PACKET);
/* Should be always 0x0 or 0xFF for error */
packet->field_count = uint1korr(p);
@ -834,7 +868,7 @@ php_mysqlnd_eof_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_eof_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "EOF");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "EOF", PROT_EOF_PACKET);
/* Should be always 0xFE */
packet->field_count = uint1korr(p);
@ -907,6 +941,8 @@ size_t php_mysqlnd_cmd_write(void *_packet, MYSQLND *conn TSRMLS_DC)
if (error_reporting) {
EG(error_reporting) = 0;
}
MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_PACKETS_SENT_CMD);
#ifdef MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND
php_mysqlnd_consume_uneaten_data(conn, packet->command TSRMLS_CC);
@ -972,7 +1008,7 @@ php_mysqlnd_rset_header_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_rset_header_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "resultset header");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "resultset header", PROT_RSET_HEADER_PACKET);
/*
Don't increment. First byte is 0xFF on error, but otherwise is starting byte
@ -1086,7 +1122,7 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_rset_field_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "field");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "field", PROT_RSET_FLD_PACKET);
if (packet->skip_parsing) {
DBG_RETURN(PASS);
@ -1366,10 +1402,46 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
if (*null_ptr & bit) {
DBG_INF("It's null");
ZVAL_NULL(*current_field);
MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_BINARY_TYPE_FETCHED_NULL);
} else {
enum_mysqlnd_field_types type = fields_metadata[i].type;
mysqlnd_ps_fetch_functions[type].func(*current_field, &fields_metadata[i],
0, &p, as_unicode TSRMLS_CC);
if (MYSQLND_G(collect_statistics)) {
enum_mysqlnd_collected_stats statistic;
switch (fields_metadata[i].type) {
case MYSQL_TYPE_DECIMAL: statistic = STAT_BINARY_TYPE_FETCHED_DECIMAL; break;
case MYSQL_TYPE_TINY: statistic = STAT_BINARY_TYPE_FETCHED_INT8; break;
case MYSQL_TYPE_SHORT: statistic = STAT_BINARY_TYPE_FETCHED_INT16; break;
case MYSQL_TYPE_LONG: statistic = STAT_BINARY_TYPE_FETCHED_INT32; break;
case MYSQL_TYPE_FLOAT: statistic = STAT_BINARY_TYPE_FETCHED_FLOAT; break;
case MYSQL_TYPE_DOUBLE: statistic = STAT_BINARY_TYPE_FETCHED_DOUBLE; break;
case MYSQL_TYPE_NULL: statistic = STAT_BINARY_TYPE_FETCHED_NULL; break;
case MYSQL_TYPE_TIMESTAMP: statistic = STAT_BINARY_TYPE_FETCHED_TIMESTAMP; break;
case MYSQL_TYPE_LONGLONG: statistic = STAT_BINARY_TYPE_FETCHED_INT64; break;
case MYSQL_TYPE_INT24: statistic = STAT_BINARY_TYPE_FETCHED_INT24; break;
case MYSQL_TYPE_DATE: statistic = STAT_BINARY_TYPE_FETCHED_DATE; break;
case MYSQL_TYPE_TIME: statistic = STAT_BINARY_TYPE_FETCHED_TIME; break;
case MYSQL_TYPE_DATETIME: statistic = STAT_BINARY_TYPE_FETCHED_DATETIME; break;
case MYSQL_TYPE_YEAR: statistic = STAT_BINARY_TYPE_FETCHED_YEAR; break;
case MYSQL_TYPE_NEWDATE: statistic = STAT_BINARY_TYPE_FETCHED_DATE; break;
case MYSQL_TYPE_VARCHAR: statistic = STAT_BINARY_TYPE_FETCHED_STRING; break;
case MYSQL_TYPE_BIT: statistic = STAT_BINARY_TYPE_FETCHED_BIT; break;
case MYSQL_TYPE_NEWDECIMAL: statistic = STAT_BINARY_TYPE_FETCHED_DECIMAL; break;
case MYSQL_TYPE_ENUM: statistic = STAT_BINARY_TYPE_FETCHED_ENUM; break;
case MYSQL_TYPE_SET: statistic = STAT_BINARY_TYPE_FETCHED_SET; break;
case MYSQL_TYPE_TINY_BLOB: statistic = STAT_BINARY_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_MEDIUM_BLOB:statistic = STAT_BINARY_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_LONG_BLOB: statistic = STAT_BINARY_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_BLOB: statistic = STAT_BINARY_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_VAR_STRING: statistic = STAT_BINARY_TYPE_FETCHED_STRING; break;
case MYSQL_TYPE_STRING: statistic = STAT_BINARY_TYPE_FETCHED_STRING; break;
case MYSQL_TYPE_GEOMETRY: statistic = STAT_BINARY_TYPE_FETCHED_GEOMETRY; break;
default: statistic = STAT_BINARY_TYPE_FETCHED_OTHER; break;
}
MYSQLND_INC_CONN_STATISTIC(&conn->stats, statistic);
}
}
if (!((bit<<=1) & 255)) {
bit = 1; /* to the following byte */
@ -1443,6 +1515,40 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
struct st_mysqlnd_perm_bind perm_bind =
mysqlnd_ps_fetch_functions[fields_metadata[i].type];
#endif
if (MYSQLND_G(collect_statistics)) {
enum_mysqlnd_collected_stats statistic;
switch (fields_metadata[i].type) {
case MYSQL_TYPE_DECIMAL: statistic = STAT_TEXT_TYPE_FETCHED_DECIMAL; break;
case MYSQL_TYPE_TINY: statistic = STAT_TEXT_TYPE_FETCHED_INT8; break;
case MYSQL_TYPE_SHORT: statistic = STAT_TEXT_TYPE_FETCHED_INT16; break;
case MYSQL_TYPE_LONG: statistic = STAT_TEXT_TYPE_FETCHED_INT32; break;
case MYSQL_TYPE_FLOAT: statistic = STAT_TEXT_TYPE_FETCHED_FLOAT; break;
case MYSQL_TYPE_DOUBLE: statistic = STAT_TEXT_TYPE_FETCHED_DOUBLE; break;
case MYSQL_TYPE_NULL: statistic = STAT_TEXT_TYPE_FETCHED_NULL; break;
case MYSQL_TYPE_TIMESTAMP: statistic = STAT_TEXT_TYPE_FETCHED_TIMESTAMP; break;
case MYSQL_TYPE_LONGLONG: statistic = STAT_TEXT_TYPE_FETCHED_INT64; break;
case MYSQL_TYPE_INT24: statistic = STAT_TEXT_TYPE_FETCHED_INT24; break;
case MYSQL_TYPE_DATE: statistic = STAT_TEXT_TYPE_FETCHED_DATE; break;
case MYSQL_TYPE_TIME: statistic = STAT_TEXT_TYPE_FETCHED_TIME; break;
case MYSQL_TYPE_DATETIME: statistic = STAT_TEXT_TYPE_FETCHED_DATETIME; break;
case MYSQL_TYPE_YEAR: statistic = STAT_TEXT_TYPE_FETCHED_YEAR; break;
case MYSQL_TYPE_NEWDATE: statistic = STAT_TEXT_TYPE_FETCHED_DATE; break;
case MYSQL_TYPE_VARCHAR: statistic = STAT_TEXT_TYPE_FETCHED_STRING; break;
case MYSQL_TYPE_BIT: statistic = STAT_TEXT_TYPE_FETCHED_BIT; break;
case MYSQL_TYPE_NEWDECIMAL: statistic = STAT_TEXT_TYPE_FETCHED_DECIMAL; break;
case MYSQL_TYPE_ENUM: statistic = STAT_TEXT_TYPE_FETCHED_ENUM; break;
case MYSQL_TYPE_SET: statistic = STAT_TEXT_TYPE_FETCHED_SET; break;
case MYSQL_TYPE_TINY_BLOB: statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_MEDIUM_BLOB:statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_LONG_BLOB: statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_BLOB: statistic = STAT_TEXT_TYPE_FETCHED_BLOB; break;
case MYSQL_TYPE_VAR_STRING: statistic = STAT_TEXT_TYPE_FETCHED_STRING; break;
case MYSQL_TYPE_STRING: statistic = STAT_TEXT_TYPE_FETCHED_STRING; break;
case MYSQL_TYPE_GEOMETRY: statistic = STAT_TEXT_TYPE_FETCHED_GEOMETRY; break;
default: statistic = STAT_TEXT_TYPE_FETCHED_OTHER; break;
}
MYSQLND_INC_CONN_STATISTIC(&conn->stats, statistic);
}
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
if (as_int && perm_bind.php_type == IS_LONG &&
@ -1574,7 +1680,7 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
if (Z_TYPE_P(*current_field) == IS_STRING) {
((mysqlnd_zval *) obj)->point_type = MYSQLND_POINTS_INT_BUFFER;
} else {
((mysqlnd_zval *) obj)->point_type = MYSQLND_POINTS_EXT_BUFFER;
((mysqlnd_zval *) obj)->point_type = MYSQLND_POINTS_EXT_BUFFER;
}
}
#endif
@ -1622,6 +1728,10 @@ php_mysqlnd_rowp_read(void *_packet, MYSQLND *conn TSRMLS_DC)
if (FAIL == ret) {
goto end;
}
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, packet_type_to_statistic_byte_count[PROT_ROW_PACKET],
MYSQLND_HEADER_SIZE + packet->header.size,
packet_type_to_statistic_packet_count[PROT_ROW_PACKET],
1);
/* packet->row_buffer->ptr is of size 'data_size + 1' */
packet->header.size = data_size;
@ -1727,7 +1837,7 @@ php_mysqlnd_stats_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_stats_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "statistics");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "statistics", PROT_STATS_PACKET);
packet->message = mnd_pemalloc(packet->header.size + 1, conn->persistent);
memcpy(packet->message, buf, packet->header.size);
@ -1772,7 +1882,7 @@ php_mysqlnd_prepare_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_prepare_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "prepare");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "prepare", PROT_PREPARE_RESP_PACKET);
data_size = packet->header.size;
packet->error_code = uint1korr(p);
@ -1851,7 +1961,7 @@ php_mysqlnd_chg_user_read(void *_packet, MYSQLND *conn TSRMLS_DC)
DBG_ENTER("php_mysqlnd_chg_user_read");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "change user response ");
PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "change user response", PROT_CHG_USER_PACKET);
/*
Don't increment. First byte is 0xFF on error, but otherwise is starting byte