Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Just to clarify, this applies only to the 5_3 branch. May the source be with you, Best regards, Jess Portnoy Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Hi Andrey, Yes, it compiled just fine with my patch. Even loaded :) May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Reason is MYSQL_VERSION_ID is defined here: ext/mysqlnd/mysqlnd_libmysql_compat.h:#define MYSQL_VERSION_ID MYSQLND_VERSION_ID And then, included here: ext/mysqli/mysqli_mysqlnd.h:#include ext/mysqlnd/mysqlnd_libmysql_compat.h Same is done with MySQL and PDO_MYSQL. May the source be with you, Best regards, Jess Portnoy Jess Portnoy wrote: Hi Andrey, Yes, it compiled just fine with my patch. Even loaded :) May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Jess Portnoy wrote: Reason is MYSQL_VERSION_ID is defined here: ext/mysqlnd/mysqlnd_libmysql_compat.h:#define MYSQL_VERSION_ID MYSQLND_VERSION_ID And then, included here: ext/mysqli/mysqli_mysqlnd.h:#include ext/mysqlnd/mysqlnd_libmysql_compat.h Same is done with MySQL and PDO_MYSQL. May the source be with you, Best regards, Jess Portnoy MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you use pre-5.0 libmysql headers this should not compile. the bit_ macros are specific to mysqlnd, not exposed by libmysql. Andrey Jess Portnoy wrote: Hi Andrey, Yes, it compiled just fine with my patch. Even loaded :) May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Hi Andrey, I understand. If the the bit_ macros are specific to mysqlnd then perhaps their usage should also be protected by an #ifdef MYSQLI_USE_MYSQLND? May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Jess Portnoy wrote: Reason is MYSQL_VERSION_ID is defined here: ext/mysqlnd/mysqlnd_libmysql_compat.h:#define MYSQL_VERSION_ID MYSQLND_VERSION_ID And then, included here: ext/mysqli/mysqli_mysqlnd.h:#include ext/mysqlnd/mysqlnd_libmysql_compat.h Same is done with MySQL and PDO_MYSQL. May the source be with you, Best regards, Jess Portnoy MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you use pre-5.0 libmysql headers this should not compile. the bit_ macros are specific to mysqlnd, not exposed by libmysql. Andrey Jess Portnoy wrote: Hi Andrey, Yes, it compiled just fine with my patch. Even loaded :) May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Jess Portnoy wrote: Hi Andrey, I understand. If the the bit_ macros are specific to mysqlnd then perhaps their usage should also be protected by an #ifdef MYSQLI_USE_MYSQLND? by specific I mean that mysqlnd introduces them but they are valid for everyone who wants to be able to decode BIT columns sent from the server. Without these macros BIT fields are useless in the client, can't be decoded. Johannes did some change in a recent commit, but I am not sure if all of mysqlnd's headers are installed at make install. This should be the case or no extension that relies on mysqlnd will be able to compile as a module (with phpize). May the source be with you, Best regards, Jess Portnoy Best, Andrey Andrey Hristov wrote: Jess Portnoy wrote: Reason is MYSQL_VERSION_ID is defined here: ext/mysqlnd/mysqlnd_libmysql_compat.h:#define MYSQL_VERSION_ID MYSQLND_VERSION_ID And then, included here: ext/mysqli/mysqli_mysqlnd.h:#include ext/mysqlnd/mysqlnd_libmysql_compat.h Same is done with MySQL and PDO_MYSQL. May the source be with you, Best regards, Jess Portnoy MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you use pre-5.0 libmysql headers this should not compile. the bit_ macros are specific to mysqlnd, not exposed by libmysql. Andrey Jess Portnoy wrote: Hi Andrey, Yes, it compiled just fine with my patch. Even loaded :) May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
I see but assuming mysqlnd is copied, I can still see a problem, in the configure script: echo #define $php_def_have_what 1 ext/mysqlnd/php_mysqlnd_config.h When running my configure: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv ext/mysqlnd/php_mysqlnd_config.h is not created and ext/mysqlnd/mysqlnd_portability.h attempts to include that and hence, even if the mysqlnd dir is copied to $PHP_PREFIX/include/php/ext regardless of your configure argument, there will still be a problem with this auto generated header. May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Jess Portnoy wrote: Hi Andrey, I understand. If the the bit_ macros are specific to mysqlnd then perhaps their usage should also be protected by an #ifdef MYSQLI_USE_MYSQLND? by specific I mean that mysqlnd introduces them but they are valid for everyone who wants to be able to decode BIT columns sent from the server. Without these macros BIT fields are useless in the client, can't be decoded. Johannes did some change in a recent commit, but I am not sure if all of mysqlnd's headers are installed at make install. This should be the case or no extension that relies on mysqlnd will be able to compile as a module (with phpize). May the source be with you, Best regards, Jess Portnoy Best, Andrey Andrey Hristov wrote: Jess Portnoy wrote: Reason is MYSQL_VERSION_ID is defined here: ext/mysqlnd/mysqlnd_libmysql_compat.h:#define MYSQL_VERSION_ID MYSQLND_VERSION_ID And then, included here: ext/mysqli/mysqli_mysqlnd.h:#include ext/mysqlnd/mysqlnd_libmysql_compat.h Same is done with MySQL and PDO_MYSQL. May the source be with you, Best regards, Jess Portnoy MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you use pre-5.0 libmysql headers this should not compile. the bit_ macros are specific to mysqlnd, not exposed by libmysql. Andrey Jess Portnoy wrote: Hi Andrey, Yes, it compiled just fine with my patch. Even loaded :) May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, does it compile after that, because I guess it doesn't. We use some macros from that header file to be able to handle bit types correctly in mysqli, when libmysql is used. #if MYSQL_VERSION_ID 50002 if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) { my_ulonglong llval; char tmp[22]; switch (field_len[i]) { case 8:llval = (my_ulonglong) bit_uint8korr(row[i]);break; case 7:llval = (my_ulonglong) bit_uint7korr(row[i]);break; case 6:llval = (my_ulonglong) bit_uint6korr(row[i]);break; case 5:llval = (my_ulonglong) bit_uint5korr(row[i]);break; case 4:llval = (my_ulonglong) bit_uint4korr(row[i]);break; case 3:llval = (my_ulonglong) bit_uint3korr(row[i]);break; case 2:llval = (my_ulonglong) bit_uint2korr(row[i]);break; case 1:llval = (my_ulonglong) uint1korr(row[i]);break; } #endif Best, Andrey Jess Portnoy wrote: Hello all, My configure command is as follows: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv I then archive the result and use it to build various PHP extensions, among which MySQLi. Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing this following code to fail compilation: #include ext/mysqlnd/mysqlnd_portability.h Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and php-5.3.1/ext/mysqli/mysqli_api.c, basically: +#ifdef MYSQLI_USE_MYSQLND #include ext/mysqlnd/mysqlnd_portability.h +#endif Thanks in advance, -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Hi Jess, Jess Portnoy wrote: I see but assuming mysqlnd is copied, I can still see a problem, in the configure script: echo #define $php_def_have_what 1 ext/mysqlnd/php_mysqlnd_config.h When running my configure: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv ext/mysqlnd/php_mysqlnd_config.h is not created and ext/mysqlnd/mysqlnd_portability.h attempts to include that and hence, even if the mysqlnd dir is copied to $PHP_PREFIX/include/php/ext regardless of your configure argument, there will still be a problem with this auto generated header. May the source be with you, Best regards, Jess Portnoy Possible solution is to copy the macros from mysqlnd_portability.h to mysqli and use ifndef to define them, if mysqlnd_portability.h is not available. Hopefully the code will compile without the need to typedef types as the macros use C99 types (uintXX_t) which should be available mostly anywhere. Best, Andrey -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql
Hi Andrey, Sounds good to me. Would you like me to test and submit a patch or will you? May the source be with you, Best regards, Jess Portnoy Andrey Hristov wrote: Hi Jess, Jess Portnoy wrote: I see but assuming mysqlnd is copied, I can still see a problem, in the configure script: echo #define $php_def_have_what 1 ext/mysqlnd/php_mysqlnd_config.h When running my configure: ./configure --disable-xml --disable-dom --disable-libxml --disable-simplexml --without-pear --disable-xmlreader --disable-xmlwriter --without-iconv ext/mysqlnd/php_mysqlnd_config.h is not created and ext/mysqlnd/mysqlnd_portability.h attempts to include that and hence, even if the mysqlnd dir is copied to $PHP_PREFIX/include/php/ext regardless of your configure argument, there will still be a problem with this auto generated header. May the source be with you, Best regards, Jess Portnoy Possible solution is to copy the macros from mysqlnd_portability.h to mysqli and use ifndef to define them, if mysqlnd_portability.h is not available. Hopefully the code will compile without the need to typedef types as the macros use C99 types (uintXX_t) which should be available mostly anywhere. Best, Andrey -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php