List:Commits« Previous MessageNext Message »
From:ahristov Date:August 3 2007 2:55pm
Subject:PHP mysqlnd svn commit: r853 - trunk/mysqlnd
View as plain text  
Author: ahristov
Date: 2007-08-03 16:55:29 +0200 (Fri, 03 Aug 2007)
New Revision: 853

Modified:
   trunk/mysqlnd/mysqlnd_portability.h
   trunk/mysqlnd/mysqlnd_priv.h
   trunk/mysqlnd/mysqlnd_ps_codec.c
   trunk/mysqlnd/mysqlnd_wireprotocol.c
Log:
Fix BIT failures. Down to 16 in unicode mode.
There was wrong decoding macro.

Also removed not needed parameter, as from MYSQLND_FIELD
we can see if the column is BIT or not. BIT has different
byte order, and thus decoding, compared to integer types.


Modified: trunk/mysqlnd/mysqlnd_portability.h
===================================================================
--- trunk/mysqlnd/mysqlnd_portability.h	2007-08-02 18:38:46 UTC (rev 852)
+++ trunk/mysqlnd/mysqlnd_portability.h	2007-08-03 14:55:29 UTC (rev 853)
@@ -153,11 +153,11 @@
 									(((uint32) (((uchar*) (A))[1])) << 16) +\
 									(((uint32) (((uchar*) (A))[0])) << 24)))
 
-#define bit_uint5korr(A)  ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
-                                  (((uint32) ((uchar) (A)[1])) << 8) +\
+#define bit_uint5korr(A)  ((ulonglong)(((uint32) ((uchar) (A)[4])) +\
+                                  (((uint32) ((uchar) (A)[3])) << 8) +\
                                   (((uint32) ((uchar) (A)[2])) << 16) +\
-                                  (((uint32) ((uchar) (A)[3])) << 24)) +\
-                               (((ulonglong) ((uchar) (A)[4])) << 32))
+                                  (((uint32) ((uchar) (A)[1])) << 24)) +\
+                               (((ulonglong) ((uchar) (A)[0])) << 32))
 
 #define bit_uint6korr(A)	((ulonglong)(((uint32) (((uchar*) (A))[5])) +\
 									(((uint32) (((uchar*) (A))[4])) << 8) +\

Modified: trunk/mysqlnd/mysqlnd_priv.h
===================================================================
--- trunk/mysqlnd/mysqlnd_priv.h	2007-08-02 18:38:46 UTC (rev 852)
+++ trunk/mysqlnd/mysqlnd_priv.h	2007-08-03 14:55:29 UTC (rev 853)
@@ -176,7 +176,7 @@
 
 void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
 								uint pack_len, zend_uchar **row, zend_bool as_unicode,
-								unsigned int byte_count, zend_bool is_bit TSRMLS_DC);
+								unsigned int byte_count TSRMLS_DC);
 
 
 

Modified: trunk/mysqlnd/mysqlnd_ps_codec.c
===================================================================
--- trunk/mysqlnd/mysqlnd_ps_codec.c	2007-08-02 18:38:46 UTC (rev 852)
+++ trunk/mysqlnd/mysqlnd_ps_codec.c	2007-08-03 14:55:29 UTC (rev 853)
@@ -67,10 +67,11 @@
 /* {{{ ps_fetch_from_1_to_8_bytes */
 void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
 								uint pack_len, zend_uchar **row, zend_bool as_unicode,
-								unsigned int byte_count, zend_bool is_bit TSRMLS_DC)
+								unsigned int byte_count TSRMLS_DC)
 {
 	char tmp[22];
 	size_t tmp_len = 0;
+	zend_bool is_bit = field->type == MYSQL_TYPE_BIT;
 	if (field->flags & UNSIGNED_FLAG) {
 		my_uint64 uval = 0;
 
@@ -154,7 +155,7 @@
 				   uint pack_len, zend_uchar **row,
 				   zend_bool as_unicode TSRMLS_DC)
 {
-	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 1, FALSE TSRMLS_CC);
+	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 1 TSRMLS_CC);
 #if 0
 	if (field->flags & UNSIGNED_FLAG) {
 		ZVAL_LONG(zv, *(my_uint8*)*row);
@@ -173,7 +174,7 @@
 					uint pack_len, zend_uchar **row,
 					zend_bool as_unicode TSRMLS_DC)
 {
-	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 2, FALSE TSRMLS_CC);
+	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 2 TSRMLS_CC);
 #if 0
 	if (field->flags & UNSIGNED_FLAG) {
 		ZVAL_LONG(zv, (my_uint16) sint2korr(*row));
@@ -192,7 +193,7 @@
 					uint pack_len, zend_uchar **row,
 					zend_bool as_unicode TSRMLS_DC)
 {
-	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 4, FALSE TSRMLS_CC);
+	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 4 TSRMLS_CC);
 #if 0
 
 	if (field->flags & UNSIGNED_FLAG) {
@@ -241,7 +242,7 @@
 					uint pack_len, zend_uchar **row,
 					zend_bool as_unicode TSRMLS_DC)
 {
-	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 8, FALSE TSRMLS_CC);
+	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, 8 TSRMLS_CC);
 #if 0
 
 	my_uint64 llval = (my_uint64) sint8korr(*row);
@@ -501,7 +502,7 @@
 				  zend_bool as_unicode TSRMLS_DC)
 {
 	unsigned long length= php_mysqlnd_net_field_length(row);
-	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, length, TRUE
TSRMLS_CC);
+	ps_fetch_from_1_to_8_bytes(zv, field, pack_len, row, as_unicode, length TSRMLS_CC);
 }
 /* }}} */
 

Modified: trunk/mysqlnd/mysqlnd_wireprotocol.c
===================================================================
--- trunk/mysqlnd/mysqlnd_wireprotocol.c	2007-08-02 18:38:46 UTC (rev 852)
+++ trunk/mysqlnd/mysqlnd_wireprotocol.c	2007-08-03 14:55:29 UTC (rev 853)
@@ -1353,7 +1353,7 @@
 				*/
 				zend_uchar *start = bit_area;
 				ps_fetch_from_1_to_8_bytes(*current_field, &(packet->fields_metadata[i]),
-							   			   0, &p, as_unicode, len, TRUE TSRMLS_CC);
+							   			   0, &p, as_unicode, len TSRMLS_CC);
 				/*
 				  We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
 				  later in this function there will be an advancement.

Thread
PHP mysqlnd svn commit: r853 - trunk/mysqlndahristov3 Aug