dmitry Tue Aug 16 12:29:16 2005 EDT
Modified files:
/php-src/ext/pdo pdo_dbh.c pdo_stmt.c
/php-src/ext/pdo/tests pdo_016.phpt
Log:
Unicode support
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_dbh.c?r1=1.85&r2=1.86&ty=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.85 php-src/ext/pdo/pdo_dbh.c:1.86
--- php-src/ext/pdo/pdo_dbh.c:1.85 Mon Aug 15 12:13:02 2005
+++ php-src/ext/pdo/pdo_dbh.c Tue Aug 16 12:29:13 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dbh.c,v 1.85 2005/08/15 16:13:02 dmitry Exp $ */
+/* $Id: pdo_dbh.c,v 1.86 2005/08/16 16:29:13 dmitry Exp $ */
/* The PDO Database Handle Class */
@@ -428,10 +428,24 @@
zval z_key;
MAKE_STD_ZVAL(query_string);
- ZVAL_STRINGL(query_string, stmt->query_string, stmt->query_stringlen,
1);
- ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString")-1, 0);
+ if (UG(unicode)) {
+ UErrorCode status = U_ZERO_ERROR;
+ UChar *u_str;
+ int32_t u_len;
+
+
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str,
&u_len, stmt->query_string, stmt->query_stringlen, &status);
+ ZVAL_UNICODEL(query_string, u_str, u_len, 0);
+ u_str = zend_ascii_to_unicode("queryString",
sizeof("queryString") ZEND_FILE_LINE_CC);
+ ZVAL_UNICODEL(&z_key, u_str, sizeof("queryString")-1, 0);
+ } else {
+ ZVAL_STRINGL(query_string, stmt->query_string,
stmt->query_stringlen, 1);
+ ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString")-1, 0);
+ }
std_object_handlers.write_property(object, &z_key, query_string
TSRMLS_CC);
zval_ptr_dtor(&query_string);
+ if (UG(unicode)) {
+ zval_dtor(&z_key);
+ }
if (dbstmt_ce->constructor) {
zend_fcall_info fci;
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.120&r2=1.121&ty=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.120 php-src/ext/pdo/pdo_stmt.c:1.121
--- php-src/ext/pdo/pdo_stmt.c:1.120 Mon Aug 15 12:13:02 2005
+++ php-src/ext/pdo/pdo_stmt.c Tue Aug 16 12:29:13 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_stmt.c,v 1.120 2005/08/15 16:13:02 dmitry Exp $ */
+/* $Id: pdo_stmt.c,v 1.121 2005/08/16 16:29:13 dmitry Exp $ */
/* The PDO Statement Handle Class */
@@ -492,7 +492,19 @@
case PDO_PARAM_STR:
if (value && !(value_len == 0 &&
stmt->dbh->oracle_nulls == PDO_NULL_EMPTY_STRING)) {
- ZVAL_STRINGL(dest, value, value_len,
!caller_frees);
+ if (UG(unicode)) {
+ UErrorCode status = U_ZERO_ERROR;
+ UChar *u_str;
+ int32_t u_len;
+
+
zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str,
&u_len, value, value_len, &status);
+ ZVAL_UNICODEL(dest, u_str, u_len, 0);
+ if (caller_frees) {
+ efree(value);
+ }
+ } else {
+ ZVAL_STRINGL(dest, value, value_len,
!caller_frees);
+ }
if (caller_frees) {
caller_frees = 0;
}
@@ -787,8 +799,8 @@
INIT_PZVAL(&val);
fetch_value(stmt, &val, i++ TSRMLS_CC);
if (Z_TYPE(val) != IS_NULL) {
- convert_to_string(&val);
- if
(zend_lookup_class(Z_STRVAL(val), Z_STRLEN(val), &cep TSRMLS_CC) == FAILURE) {
+ convert_to_text(&val);
+ if
(zend_u_lookup_class(Z_TYPE(val), Z_STRVAL(val), Z_STRLEN(val), &cep TSRMLS_CC)
== FAILURE) {
stmt->fetch.cls.ce =
ZEND_STANDARD_CLASS_DEF_PTR;
} else {
stmt->fetch.cls.ce =
*cep;
@@ -1837,9 +1849,9 @@
{
pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object
TSRMLS_CC);
- convert_to_string(member);
+ convert_to_text(member);
- if(strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if ((Z_UNILEN_P(member) == sizeof("queryString")-1) &&
(ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member),
"queryString", sizeof("queryString")-1))) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property
queryString is read only" TSRMLS_CC);
} else {
std_object_handlers.write_property(object, member, value
TSRMLS_CC);
@@ -1850,9 +1862,9 @@
{
pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object
TSRMLS_CC);
- convert_to_string(member);
+ convert_to_text(member);
- if(strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if ((Z_UNILEN_P(member) == sizeof("queryString")-1) &&
(ZEND_U_EQUAL(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member),
"queryString", sizeof("queryString")-1))) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property
queryString is read only" TSRMLS_CC);
} else {
std_object_handlers.unset_property(object, member TSRMLS_CC);
http://cvs.php.net/diff.php/php-src/ext/pdo/tests/pdo_016.phpt?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/pdo/tests/pdo_016.phpt
diff -u php-src/ext/pdo/tests/pdo_016.phpt:1.9
php-src/ext/pdo/tests/pdo_016.phpt:1.10
--- php-src/ext/pdo/tests/pdo_016.phpt:1.9 Mon Aug 15 10:37:54 2005
+++ php-src/ext/pdo/tests/pdo_016.phpt Tue Aug 16 12:29:16 2005
@@ -196,7 +196,7 @@
string(7) "String0"
string(7) "String1"
string(7) "String2"
---UXPECT--
+--UEXPECT--
unicode(1) "3"
array(3) {
[0]=>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php