]> granicus.if.org Git - php/commitdiff
More debugging info for the trace log
authorAndrey Hristov <andrey@php.net>
Tue, 22 Jul 2008 16:06:08 +0000 (16:06 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 22 Jul 2008 16:06:08 +0000 (16:06 +0000)
ext/mysqlnd/mysqlnd_ps_codec.c
ext/mysqlnd/mysqlnd_wireprotocol.c

index 0e2c4345dbf24f5a641bcd802038d048a7cad24f..2b37987306aeed3c2aec57c00eb3a1c55ed6c1ee 100644 (file)
@@ -72,6 +72,8 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
        char tmp[22];
        size_t tmp_len = 0;
        zend_bool is_bit = field->type == MYSQL_TYPE_BIT;
+       DBG_ENTER("ps_fetch_from_1_to_8_bytes");
+       DBG_INF_FMT("zv=%p byte_count=%d", zv, byte_count);
        if (field->flags & UNSIGNED_FLAG) {
                uint64 uval = 0;
 
@@ -88,6 +90,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
 
 #if SIZEOF_LONG==4
                if (uval > INT_MAX) {
+                       DBG_INF("stringify");
                        tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
                } else 
 #endif /* #if SIZEOF_LONG==4 */
@@ -95,6 +98,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
                        if (byte_count < 8 || uval <= L64(9223372036854775807)) {
                                ZVAL_LONG(zv, uval);
                        } else {
+                               DBG_INF("stringify");
                                tmp_len = sprintf((char *)&tmp, MYSQLND_LLU_SPEC, uval);
                        }
                }
@@ -115,6 +119,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
 
 #if SIZEOF_LONG==4
            if ((L64(2147483647) < (int64) lval) || (L64(-2147483648) > (int64) lval)) {
+                       DBG_INF("stringify");
                        tmp_len = sprintf((char *)&tmp, MYSQLND_LL_SPEC, lval);
                } else 
 #endif /* SIZEOF */
@@ -126,14 +131,17 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
        if (tmp_len) {
 #if PHP_MAJOR_VERSION >= 6
                if (as_unicode) {
+                       DBG_INF("stringify");
                        ZVAL_UTF8_STRINGL(zv, tmp, tmp_len, ZSTR_DUPLICATE);
                } else
 #endif
                {
+                       DBG_INF("stringify");
                        ZVAL_STRINGL(zv, tmp, tmp_len, 1);
                }                       
        }
        (*row)+= byte_count;
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
@@ -200,9 +208,12 @@ void ps_fetch_float(zval *zv, const MYSQLND_FIELD * const field,
                                        zend_bool as_unicode TSRMLS_DC)
 {
        float value;
+       DBG_ENTER("ps_fetch_float");
        float4get(value, *row);
        ZVAL_DOUBLE(zv, value);
        (*row)+= 4;
+       DBG_INF_FMT("value=%f", value);
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
@@ -214,9 +225,12 @@ void ps_fetch_double(zval *zv, const MYSQLND_FIELD * const field,
                                        zend_bool as_unicode TSRMLS_DC)
 {
        double value;
+       DBG_ENTER("ps_fetch_double");
        float8get(value, *row);
        ZVAL_DOUBLE(zv, value);
        (*row)+= 8;
+       DBG_INF_FMT("value=%f", value);
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
@@ -230,6 +244,7 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
        struct st_mysqlnd_time t;
        unsigned int length; /* First byte encodes the length*/
        char *to;
+       DBG_ENTER("ps_fetch_time");
 
        if ((length = php_mysqlnd_net_field_length(row))) {
                zend_uchar *to= *row;
@@ -262,6 +277,7 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
        length = spprintf(&to, 0, "%s%02u:%02u:%02u",
                                         (t.neg ? "-" : ""), t.hour, t.minute, t.second);
 
+       DBG_INF_FMT("%s", to);
 #if PHP_MAJOR_VERSION >= 6
        if (!as_unicode) {
 #endif
@@ -272,6 +288,7 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field,
                ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);       
        }
 #endif
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
@@ -285,6 +302,7 @@ void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field,
        struct st_mysqlnd_time t = {0};
        unsigned int length; /* First byte encodes the length*/
        char *to;
+       DBG_ENTER("ps_fetch_date");
 
        if ((length = php_mysqlnd_net_field_length(row))) {
                zend_uchar *to= *row;
@@ -310,6 +328,7 @@ void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field,
        */
        length = spprintf(&to, 0, "%04u-%02u-%02u", t.year, t.month, t.day);
 
+       DBG_INF_FMT("%s", to);
 #if PHP_MAJOR_VERSION >= 6
        if (!as_unicode) {
 #endif
@@ -320,6 +339,7 @@ void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field,
                ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);       
        }
 #endif
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
@@ -333,6 +353,7 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
        struct st_mysqlnd_time t;
        unsigned int length; /* First byte encodes the length*/
        char *to;
+       DBG_ENTER("ps_fetch_datetime");
 
        if ((length = php_mysqlnd_net_field_length(row))) {
                zend_uchar *to= *row;
@@ -366,6 +387,7 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
        length = spprintf(&to, 0, "%04u-%02u-%02u %02u:%02u:%02u",
                                          t.year, t.month, t.day, t.hour, t.minute, t.second);
 
+       DBG_INF_FMT("%s", to);
 #if PHP_MAJOR_VERSION >= 6
        if (!as_unicode) {
 #endif
@@ -376,6 +398,7 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field,
                ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE);       
        }
 #endif
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
@@ -390,12 +413,14 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field,
          For now just copy, before we make it possible
          to write \0 to the row buffer
        */
-       unsigned long length= php_mysqlnd_net_field_length(row);
-
+       unsigned long length = php_mysqlnd_net_field_length(row);
+       DBG_ENTER("ps_fetch_string");
+       DBG_INF_FMT("len = %lu", length);
 #if PHP_MAJOR_VERSION < 6
        ZVAL_STRINGL(zv, (char *)*row, length, 1);      
 #else
        if (field->charsetnr == MYSQLND_BINARY_CHARSET_NR) {
+               DBG_INF("Binary charset");
                ZVAL_STRINGL(zv, (char *)*row, length, 1);
        } else {
                ZVAL_UTF8_STRINGL(zv, (char*)*row, length, ZSTR_DUPLICATE);
@@ -403,6 +428,7 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field,
 #endif
 
        (*row) += length;
+       DBG_VOID_RETURN;
 }
 /* }}} */
 
index c59e1b216cbb2ee2a05c3e663f3803055a561ed1..81cf51422ee1291535276f5328cbb4df79659165 100644 (file)
@@ -462,10 +462,9 @@ mysqlnd_read_header(MYSQLND *conn, mysqlnd_packet_header *header TSRMLS_DC)
                DBG_RETURN(PASS);
        }
 
-#if !MYSQLND_SILENT
        DBG_ERR_FMT("Packets out of order. Expected %d received %d. Packet size=%d",
                                net->packet_no, header->packet_no, header->size);
-#endif
+
        php_error(E_WARNING, "Packets out of order. Expected %d received %d. Packet size=%d. PID=%d",
                          net->packet_no, header->packet_no, header->size, getpid());
        DBG_RETURN(FAIL);
@@ -1216,10 +1215,10 @@ php_mysqlnd_rset_field_read(void *_packet, MYSQLND *conn TSRMLS_DC)
                *(root_ptr +=len) = '\0';
                root_ptr++;
        }
-/*
+
        DBG_INF_FMT("FIELD=[%s.%s.%s]", meta->db? meta->db:"*NA*", meta->table? meta->table:"*NA*",
                                meta->name? meta->name:"*NA*");
-*/
+
        DBG_RETURN(PASS);
 
 faulty_or_fake:
@@ -1346,6 +1345,7 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
 
        for (i = 0; current_field < end_field; current_field++, i++) {
 #if 1
+               DBG_INF("Trying to use the zval cache");
                obj = mysqlnd_palloc_get_zval(conn->zval_cache, &allocated TSRMLS_CC);
                if (allocated) {
                        *current_field = (zval *) obj;
@@ -1355,9 +1355,16 @@ void php_mysqlnd_rowp_read_binary_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffe
                        ((mysqlnd_zval *) obj)->point_type = MYSQLND_POINTS_EXT_BUFFER;
                }
 #else
+               DBG_INF("Directly creating zval");
                MAKE_STD_ZVAL(*current_field);
 #endif
+
+               DBG_INF_FMT("Into zval=%p decoding column %d [%s.%s.%s] type=%d field->flags&unsigned=%d flags=%u is_bit=%d as_unicode=%d",
+                       *current_field, i,
+                       fields_metadata[i].db, fields_metadata[i].table, fields_metadata[i].name, fields_metadata[i].type,
+                       fields_metadata[i].flags & UNSIGNED_FLAG, fields_metadata[i].flags, fields_metadata[i].type == MYSQL_TYPE_BIT, as_unicode);
                if (*null_ptr & bit) {
+                       DBG_INF("It's null");
                        ZVAL_NULL(*current_field);
                } else {
                        enum_mysqlnd_field_types type = fields_metadata[i].type;