Re: cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c mysqli_report.c php_mysqli.h /ext/mysqli/tests
001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 009.phpt 011.phpt 012.phpt 014.phpt 015.phpt 016.phpt 017.phpt 019.phpt 020.phpt 021.phpt 022.phpt
026.phpt 028.phpt 031.phpt 032.phpt 042.phpt 043.phpt 045.phpt 047.phpt 048.phpt 049.phpt 057.phpt 058.phpt 059.phpt 060.phpt 061.phpt 062.phpt
063.phpt 065.phpt 069.phpt 072.phpt 073.phpt 074.phpt bug28817.phpt bug31141.phpt bug31668.phpt bug32405.phpt bug33263.phpt bug34785.phpt
bug35517.phpt bug36745.phpt connect.inc skipif.inc

From: Date: Tue, 26 Sep 2006 22:28:55 +0000
Subject: Re: cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c mysqli_report.c php_mysqli.h /ext/mysqli/tests
001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 009.phpt 011.phpt 012.phpt 014.phpt 015.phpt 016.phpt 017.phpt 019.phpt 020.phpt 021.phpt 022.phpt
026.phpt 028.phpt 031.phpt 032.phpt 042.phpt 043.phpt 045.phpt 047.phpt 048.phpt 049.phpt 057.phpt 058.phpt 059.phpt 060.phpt 061.phpt 062.phpt
063.phpt 065.phpt 069.phpt 072.phpt 073.phpt 074.phpt bug28817.phpt bug31141.phpt bug31668.phpt bug32405.phpt bug33263.phpt bug34785.phpt
bug35517.phpt bug36745.phpt connect.inc skipif.inc
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-25839@lists.php.net to get a copy of this message
Hey Georg, Thanks for committing the draft. I went through and made some notes on the implementation. 1. Please use ZEND_STR_TYPE instead of UG(unicode)?IS_UNICODE:IS_STRING 2. This type of thing:
+       if (UG(unicode)) {
+           UChar *ustr = USTR_MAKE("mysqli_driver");
+           is_driver = u_strcmp(obj->zo.ce->name.u, ustr);
+           USTR_FREE(ustr);
+       } else {
+           is_driver = strcmp(obj->zo.ce->name.s, "mysqli_driver");
+       }
can be simplified to: if (ZEND_U_EQUAL(obj->zo.ce->name.s, "mysqli_driver")) { ... } 3. This also:
+           php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %R", UG(unicode)?IS_UNICODE:IS_STRING, obj->zo.ce->name );
cna be simplified to:
           php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %v", obj->zo.ce->name );
4. We have a macro for this:
+           if (UG(unicode)) {
+               UChar *ustr;
+               int ulen;
+
+               zend_string_to_unicode(MYSQLI_CONV_UTF8, &ustr, &ulen, row[i], field_len[i]);
+               ZVAL_UNICODEL(res, ustr, ulen, 0);
+           } else {
+               ZVAL_STRINGL(res, row[i], field_len[i], 1);
+           }
Just do: ZVAL_UTF8_STRINGL(res, row[i], field_len[i], ZSTR_DUPLICATE); 5. Your comment:
+                   /* maybe a bug in add_u_assoc_zval_ex: string is truncated when specifying ulen only */
+                   add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res);
is not valid. You always have to specify the length of the full key, including the NULL byte. 6. Instead of doing this:
+           MYSQLI_CONVERT_PARAM_STRING(statement, MYSQLI_CONV_UTF8);
You can use 's&' specifier and pass the converter, as in: if (zend_parse_parameters(2 TSRMLS_CC, "Os", &mysql_link, mysqli_link_class_entry, &str, &str_len, UG(utf8_conv))==FAILURE) 7. This is unnecessary:
+    MYSQLI_RETURN_CONV_STRINGL(MYSQLI_CONV_UTF8, csname, strlen(csname), 1);
Just use RETURN_UTF8_STRINGL() macro. 8. Don't forget there's also convert_to_string_with_converter[_ex]() and convert_to_unicode_with_converter[_ex] macros. They're useful. I didn't go further, because I think we need to fix these first.. -Andrei On Sep 26, 2006, at 6:06 AM, Georg Richter wrote:
georg Tue Sep 26 13:06:13 2006 UTC Modified files:
    /php-src/ext/mysqli	mysqli.c mysqli_api.c mysqli_driver.c
                       	mysqli_nonapi.c mysqli_prop.c mysqli_report.c
                       	php_mysqli.h
    /php-src/ext/mysqli/tests	001.phpt 002.phpt 003.phpt 004.phpt
                             	005.phpt 009.phpt 011.phpt 012.phpt
                             	014.phpt 015.phpt 016.phpt 017.phpt
                             	019.phpt 020.phpt 021.phpt 022.phpt
                             	026.phpt 028.phpt 031.phpt 032.phpt
                             	042.phpt 043.phpt 045.phpt 047.phpt
                             	048.phpt 049.phpt 057.phpt 058.phpt
                             	059.phpt 060.phpt 061.phpt 062.phpt
                             	063.phpt 065.phpt 069.phpt 072.phpt
                             	073.phpt 074.phpt bug28817.phpt
                             	bug31141.phpt bug31668.phpt bug32405.phpt
                             	bug33263.phpt bug34785.phpt bug35517.phpt
                             	bug36745.phpt connect.inc skipif.inc
Log: added unicode support for mysqli extension <georg-20060926130613.txt> --PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#25839) next »