int hashed_details_length, port = MYSQL_PORT;
long client_flags = 0;
php_mysql_conn *mysql=NULL;
+ char *encoding = mysql_character_set_name(mysql->conn);
#if MYSQL_VERSION_ID <= 32230
void (*handler) (int);
#endif
#else
mysql->conn = mysql_init(persistent);
#endif
- if (UG(unicode)) {
- mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
- }
+ mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
if (connect_timeout != -1) {
mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
#if !defined(MYSQL_USE_MYSQLND)
- if (UG(unicode)) {
#ifdef MYSQL_HAS_SET_CHARSET
- mysql_set_character_set(mysql->conn, "utf8");
+ mysql_set_character_set(mysql->conn, "utf8");
#else
- char *encoding = mysql_character_set_name(mysql->conn);
- if (strcasecmp((char*)encoding, "utf8")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
+ if (strcasecmp((char*)encoding, "utf8")) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
+ MYSQL_DO_CONNECT_RETURN_FALSE();
+ }
#endif
- }
#endif
/* hash it up */
#endif
if (mysql_ping(mysql->conn)) {
if (mysql_errno(mysql->conn) == 2006) {
- if (UG(unicode)) {
- mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
- }
+ mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
#ifndef MYSQL_USE_MYSQLND
if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
#else
MYSQL_DO_CONNECT_RETURN_FALSE();
}
#if !defined(MYSQL_USE_MYSQLND)
- if (UG(unicode)) {
#ifdef MYSQL_HAS_SET_CHARSET
- mysql_set_character_set(mysql->conn, "utf8");
+ mysql_set_character_set(mysql->conn, "utf8");
#else
- char *encoding = mysql_character_set_name(mysql->conn);
- if (strcasecmp((char*)encoding, "utf8")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
+ if (strcasecmp((char*)encoding, "utf8")) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
+ MYSQL_DO_CONNECT_RETURN_FALSE();
+ }
#endif
- }
#endif
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
}
mysql->conn = mysql_init(persistent);
#endif
- if (UG(unicode)) {
- mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
- }
+ mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, "utf8");
+
if (connect_timeout != -1) {
mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout);
}
}
#if !defined(MYSQL_USE_MYSQLND)
- if (UG(unicode)) {
#ifdef MYSQL_HAS_SET_CHARSET
- mysql_set_character_set(mysql->conn, "utf8");
+ mysql_set_character_set(mysql->conn, "utf8");
#else
- char *encoding = mysql_character_set_name(mysql->conn);
- if (strcasecmp((char*)encoding, "utf8")) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
- MYSQL_DO_CONNECT_RETURN_FALSE();
- }
+ if (strcasecmp((char*)encoding, "utf8")) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't connect in Unicode mode. Client library was compiled with default charset %s", encoding);
+ MYSQL_DO_CONNECT_RETURN_FALSE();
+ }
#endif
- }
#endif
mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile));
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
/* Only allow the use of this function with unicode.semantics=On */
- if (UG(unicode) && (csname_len != 4 || strncasecmp(csname, "utf8", 4))) {
+ if (csname_len != 4 || strncasecmp(csname, "utf8", 4)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Character set %s is not supported when running PHP with unicode.semantics=On.", csname);
RETURN_FALSE;
}
MAKE_STD_ZVAL(data);
- if (UG(unicode) && !IS_BINARY_DATA(mysql_field)) {
+ if (!IS_BINARY_DATA(mysql_field)) {
UChar *ustr;
int ulen;
add_index_zval(return_value, i, data);
}
if (result_type & MYSQL_ASSOC) {
+ UChar *ustr;
+ int ulen;
+
if (result_type & MYSQL_NUM) {
Z_ADDREF_P(data);
}
- if (UG(unicode)) {
- UChar *ustr;
- int ulen;
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
- add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, data);
- efree(ustr);
- } else {
- add_assoc_zval(return_value, mysql_field->name, data);
- }
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
+ add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, data);
+ efree(ustr);
}
} else {
/* NULL value. */
}
if (result_type & MYSQL_ASSOC) {
- if (UG(unicode)) {
- UChar *ustr;
- int ulen;
+ UChar *ustr;
+ int ulen;
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
- add_u_assoc_null_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1);
- efree(ustr);
- } else {
- add_assoc_null(return_value, mysql_field->name);
- }
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysql_field->name, strlen(mysql_field->name) TSRMLS_CC);
+ add_u_assoc_null_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1);
+ efree(ustr);
}
}
}
void php_mysqli_dtor_p_elements(void *data)
{
MYSQL *mysql = (MYSQL *) data;
- TSRMLS_FETCH();
+
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);
}
if (member->type != IS_STRING && member->type != IS_UNICODE) {
tmp_member = *member;
zval_copy_ctor(&tmp_member);
- convert_to_text(&tmp_member);
+ convert_to_unicode(&tmp_member);
member = &tmp_member;
}
if (obj->prop_handler != NULL) {
- ret = zend_u_hash_find(obj->prop_handler, ZEND_STR_TYPE, Z_UNIVAL_P(member), Z_UNILEN_P(member)+1, (void **) &hnd);
+ ret = zend_u_hash_find(obj->prop_handler, IS_UNICODE, Z_UNIVAL_P(member), Z_UNILEN_P(member)+1, (void **) &hnd);
}
if (ret == SUCCESS) {
if (member->type != IS_STRING && member->type != IS_UNICODE) {
tmp_member = *member;
zval_copy_ctor(&tmp_member);
- convert_to_text(&tmp_member);
+ convert_to_unicode(&tmp_member);
member = &tmp_member;
}
zend_ascii_hash_add(retval, entry->name, entry->name_len + 1, &value, sizeof(zval *), NULL);
}
zend_hash_move_forward_ex(props, &pos);
- if (UG(unicode)) {
- zval_dtor(&member);
- }
+ zval_dtor(&member);
}
*is_temp = 1;
mysqli_base_class = mysqli_base_class->parent;
}
- zend_u_hash_find(&classes, ZEND_STR_TYPE, mysqli_base_class->name, mysqli_base_class->name_length + 1,
+ zend_u_hash_find(&classes, IS_UNICODE, mysqli_base_class->name, mysqli_base_class->name_length + 1,
(void **) &intern->prop_handler);
zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
zend_u_hash_init(&mysqli_driver_properties, 0, NULL, NULL, 1, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_driver_properties, mysqli_driver_property_entries);
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_driver_property_info_entries);
- zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
+ zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods);
zend_u_hash_init(&mysqli_link_properties, 0, NULL, NULL, 1, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_link_properties, mysqli_link_property_entries);
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_link_property_info_entries);
- zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
+ zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, mysqli_warning_methods);
ce = mysqli_warning_class_entry;
zend_u_hash_init(&mysqli_warning_properties, 0, NULL, NULL, 1, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries);
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_warning_property_info_entries);
- zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
+ zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_result", mysqli_result_class_entry, mysqli_result_methods);
ce = mysqli_result_class_entry;
zend_u_hash_init(&mysqli_result_properties, 0, NULL, NULL, 1, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_result_properties, mysqli_result_property_entries);
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_result_property_info_entries);
- zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
+ zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_stmt", mysqli_stmt_class_entry, mysqli_stmt_methods);
ce = mysqli_stmt_class_entry;
zend_u_hash_init(&mysqli_stmt_properties, 0, NULL, NULL, 1, 1);
MYSQLI_ADD_PROPERTIES(&mysqli_stmt_properties, mysqli_stmt_property_entries);
MYSQLI_ADD_PROPERTIES_INFO(ce, mysqli_stmt_property_info_entries);
- zend_u_hash_add(&classes, ZEND_STR_TYPE, ce->name, ce->name_length+1, &mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
+ zend_u_hash_add(&classes, IS_UNICODE, ce->name, ce->name_length+1, &mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
/* mysqli_options */
zval *res;
MAKE_STD_ZVAL(res);
- if (UG(unicode) && !IS_BINARY_DATA(fields[i])) {
+ if (!IS_BINARY_DATA(fields[i])) {
UChar *ustr;
int ulen;
add_index_zval(return_value, i, res);
}
if (fetchtype & MYSQLI_ASSOC) {
+ UChar *ustr;
+ int ulen;
+
if (fetchtype & MYSQLI_NUM) {
Z_ADDREF_P(res);
}
- if (UG(unicode)) {
- UChar *ustr;
- int ulen;
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
- add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res);
- efree(ustr);
- } else {
- add_assoc_zval(return_value, fields[i].name, res);
- }
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
+ add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res);
+ efree(ustr);
}
} else {
if (fetchtype & MYSQLI_NUM) {
add_index_null(return_value, i);
}
if (fetchtype & MYSQLI_ASSOC) {
- if (UG(unicode)) {
- UChar *ustr;
- int ulen;
+ UChar *ustr;
+ int ulen;
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
- add_u_assoc_null(return_value, IS_UNICODE, ZSTR(ustr));
- efree(ustr);
- } else {
- add_assoc_null(return_value, fields[i].name);
- }
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC);
+ add_u_assoc_null(return_value, IS_UNICODE, ZSTR(ustr));
+ efree(ustr);
}
}
}
}
/* Change user resets the charset in the server, change it back */
- if (UG(unicode)) {
- mysql_set_character_set(mysql->mysql, "utf8");
- }
+ mysql_set_character_set(mysql->mysql, "utf8");
RETURN_TRUE;
}
zval *the_var = copies && copies[i]? copies[i]:stmt->param.vars[i];
switch (stmt->stmt->params[i].buffer_type) {
case MYSQL_TYPE_VAR_STRING:
- if (UG(unicode) && Z_TYPE_P(the_var) == IS_UNICODE) {
+ if (Z_TYPE_P(the_var) == IS_UNICODE) {
if (the_var == stmt->param.vars[i]) {
php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i);
the_var = copies[i];
tmp[10]= '\0';
/* unsigned int > INT_MAX is 10 digits - ALWAYS */
ZVAL_UTF8_STRINGL(stmt->result.vars[i], tmp, 10, 0);
- if (UG(unicode)) {
- efree(tmp);
- }
+ efree(tmp);
break;
}
#endif
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
- if (UG(unicode) && Z_TYPE_P(callback_func) != IS_ARRAY && Z_TYPE_P(callback_func) != IS_OBJECT) {
+ if (Z_TYPE_P(callback_func) != IS_ARRAY && Z_TYPE_P(callback_func) != IS_OBJECT) {
convert_to_string(callback_func);
}
new_connection = TRUE;
}
- if (UG(unicode)) {
- mysql_options(mysql->mysql, MYSQL_SET_CHARSET_NAME, "utf8");
- }
-
+ mysql_options(mysql->mysql, MYSQL_SET_CHARSET_NAME, "utf8");
#ifdef HAVE_EMBEDDED_MYSQLI
if (hostname_len) {
}
/* when PHP runs in unicode, set default character set to utf8 */
- if (UG(unicode)) {
- mysql->conv = UG(utf8_conv);
- }
+ mysql->conv = UG(utf8_conv);
/* clear error */
php_mysqli_set_error(mysql_errno(mysql->mysql), (char *) mysql_error(mysql->mysql) TSRMLS_CC);
/* check unicode modus */
/* todo: we need also to support UCS2. This will not work when using SET NAMES */
- if (UG(unicode) && (csname_len != 4 || strncasecmp(cs_name, "utf8", 4))) {
+ if (csname_len != 4 || strncasecmp(cs_name, "utf8", 4)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Character set %s is not supported when running PHP with unicode.semantics=On.", cs_name);
RETURN_FALSE;
}
state = 1; /* all charsets are compiled in */
#endif
- if (UG(unicode)) {
- add_property_utf8_string(return_value, "charset", (name) ? (char *)name : "", 1);
- add_property_utf8_string(return_value, "collation", (collation) ? (char *)collation : "", 1);
- add_property_utf8_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
- } else {
- add_property_string(return_value, "charset", (name) ? (char *)name : "", 1);
- add_property_string(return_value, "collation",(collation) ? (char *)collation : "", 1);
- add_property_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
- }
+ add_property_utf8_string(return_value, "charset", (name) ? (char *)name : "", 1);
+ add_property_utf8_string(return_value, "collation", (collation) ? (char *)collation : "", 1);
+ add_property_utf8_string(return_value, "dir", (dir) ? (char *)dir : "", 1);
add_property_long(return_value, "min_length", minlength);
add_property_long(return_value, "max_length", maxlength);
add_property_long(return_value, "number", number);
add_property_long(return_value, "state", state);
- if (UG(unicode)) {
- add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
- } else {
- add_property_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
- }
+ add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1);
}
/* }}} */
#endif
(charset = mysqlnd_find_charset_name(conn->options.charset_name)))
{
auth_packet->charset_no = charset->nr;
-#if PHP_MAJOR_VERSION >= 6
- } else if (UG(unicode)) {
- auth_packet->charset_no = 200;/* utf8 - swedish collation, check mysqlnd_charset.c */
-#endif
} else {
+#if PHP_MAJOR_VERSION >= 6
+ auth_packet->charset_no = 200;/* utf8 - swedish collation, check mysqlnd_charset.c */
+#else
auth_packet->charset_no = greet_packet.charset_no;
+#endif
}
auth_packet->db = db;
auth_packet->db_len = db_len;
TRACE_APPEND_STR("Array, ");
break;
case IS_OBJECT: {
+ zval tmp;
zstr class_name;
zend_uint class_name_len;
int dup;
dup = zend_get_object_classname(*arg, &class_name, &class_name_len TSRMLS_CC);
- if (UG(unicode)) {
- zval tmp;
+ ZVAL_UNICODEL(&tmp, class_name.u, class_name_len, 1);
+ convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv)));
+ TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp));
+ zval_dtor(&tmp);
- ZVAL_UNICODEL(&tmp, class_name.u, class_name_len, 1);
- convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv)));
- TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp));
- zval_dtor(&tmp);
- } else {
- TRACE_APPEND_STRL(class_name.s, class_name_len);
- }
if(!dup) {
efree(class_name.v);
}
#endif
-#if PHP_MAJOR_VERSION < 6
-#define IS_UNICODE_DISABLED (1)
-#else
-#define IS_UNICODE_DISABLED (!UG(unicode))
-#endif
-
-
/* {{{ _mysqlnd_palloc_init_cache */
PHPAPI MYSQLND_ZVAL_PCACHE* _mysqlnd_palloc_init_cache(unsigned int cache_size TSRMLS_DC)
{
#if PHP_MAJOR_VERSION < 6
if (Z_TYPE_P(the_var) != IS_STRING)
#elif PHP_MAJOR_VERSION >= 6
- if (Z_TYPE_P(the_var) != IS_STRING || (UG(unicode) && Z_TYPE_P(the_var) == IS_UNICODE))
+ if (Z_TYPE_P(the_var) != IS_STRING || Z_TYPE_P(the_var) == IS_UNICODE)
#endif
{
if (!copies || !copies[i]) {
}
the_var = copies[i];
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode) && Z_TYPE_P(the_var) == IS_UNICODE) {
+ if (Z_TYPE_P(the_var) == IS_UNICODE) {
zval_unicode_to_string_ex(the_var, UG(utf8_conv) TSRMLS_CC);
}
#endif
*/
if (zend_hash_key->is_numeric == FALSE) {
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
- zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
- zend_hash_key->ustr,
- zend_hash_key->ulen + 1,
- zend_hash_key->key,
- (void *) &data, sizeof(zval *), NULL);
- } else
+ zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
+ zend_hash_key->ustr,
+ zend_hash_key->ulen + 1,
+ zend_hash_key->key,
+ (void *) &data, sizeof(zval *), NULL);
+#else
+ zend_hash_quick_update(Z_ARRVAL_P(row),
+ field->name,
+ field->name_length + 1,
+ zend_hash_key->key,
+ (void *) &data, sizeof(zval *), NULL);
#endif
- {
- zend_hash_quick_update(Z_ARRVAL_P(row),
- field->name,
- field->name_length + 1,
- zend_hash_key->key,
- (void *) &data, sizeof(zval *), NULL);
- }
} else {
zend_hash_index_update(Z_ARRVAL_P(row),
zend_hash_key->key,
*/
if (zend_hash_key->is_numeric == FALSE) {
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
- zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
- zend_hash_key->ustr,
- zend_hash_key->ulen + 1,
- zend_hash_key->key,
- (void *) &data, sizeof(zval *), NULL);
- } else
+ zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
+ zend_hash_key->ustr,
+ zend_hash_key->ulen + 1,
+ zend_hash_key->key,
+ (void *) &data, sizeof(zval *), NULL);
+#else
+ zend_hash_quick_update(Z_ARRVAL_P(row),
+ field->name,
+ field->name_length + 1,
+ zend_hash_key->key,
+ (void *) &data, sizeof(zval *), NULL);
#endif
- {
- zend_hash_quick_update(Z_ARRVAL_P(row),
- field->name,
- field->name_length + 1,
- zend_hash_key->key,
- (void *) &data, sizeof(zval *), NULL);
- }
} else {
zend_hash_index_update(Z_ARRVAL_P(row),
zend_hash_key->key,
*/
if (result->meta->zend_hash_keys[i].is_numeric == FALSE) {
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
- zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
- result->meta->zend_hash_keys[i].ustr,
- result->meta->zend_hash_keys[i].ulen + 1,
- result->meta->zend_hash_keys[i].key,
- (void *) &data, sizeof(zval *), NULL);
- } else
+ zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
+ result->meta->zend_hash_keys[i].ustr,
+ result->meta->zend_hash_keys[i].ulen + 1,
+ result->meta->zend_hash_keys[i].key,
+ (void *) &data, sizeof(zval *), NULL);
+#else
+ zend_hash_quick_update(Z_ARRVAL_P(row),
+ result->meta->fields[i].name,
+ result->meta->fields[i].name_length + 1,
+ result->meta->zend_hash_keys[i].key,
+ (void *) &data, sizeof(zval *), NULL);
#endif
- {
- zend_hash_quick_update(Z_ARRVAL_P(row),
- result->meta->fields[i].name,
- result->meta->fields[i].name_length + 1,
- result->meta->zend_hash_keys[i].key,
- (void *) &data, sizeof(zval *), NULL);
- }
} else {
zend_hash_index_update(Z_ARRVAL_P(row),
result->meta->zend_hash_keys[i].key,
{
unsigned int i = 0;
php_mysql_packet_res_field field_packet;
+ UChar *ustr;
+ int ulen;
DBG_ENTER("mysqlnd_res_meta::read_metadata");
}
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
- UChar *ustr;
- int ulen;
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen,
- meta->fields[i].name,
- meta->fields[i].name_length TSRMLS_CC);
- if ((meta->zend_hash_keys[i].is_numeric =
- mysqlnd_unicode_is_key_numeric(ustr, ulen + 1, &idx)))
- {
- meta->zend_hash_keys[i].key = idx;
- mnd_efree(ustr);
- } else {
- meta->zend_hash_keys[i].ustr.u = ustr;
- meta->zend_hash_keys[i].ulen = ulen;
- meta->zend_hash_keys[i].key = zend_u_get_hash_value(IS_UNICODE, ZSTR(ustr), ulen + 1);
- }
-
- } else
-#endif
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen,
+ meta->fields[i].name,
+ meta->fields[i].name_length TSRMLS_CC);
+ if ((meta->zend_hash_keys[i].is_numeric =
+ mysqlnd_unicode_is_key_numeric(ustr, ulen + 1, &idx)))
{
- /* For BC we have to check whether the key is numeric and use it like this */
- if ((meta->zend_hash_keys[i].is_numeric =
- mysqlnd_is_key_numeric(field_packet.metadata->name,
- field_packet.metadata->name_length + 1,
- &idx)))
- {
- meta->zend_hash_keys[i].key = idx;
- } else {
- meta->zend_hash_keys[i].key =
- zend_get_hash_value(field_packet.metadata->name,
- field_packet.metadata->name_length + 1);
- }
+ meta->zend_hash_keys[i].key = idx;
+ mnd_efree(ustr);
+ } else {
+ meta->zend_hash_keys[i].ustr.u = ustr;
+ meta->zend_hash_keys[i].ulen = ulen;
+ meta->zend_hash_keys[i].key = zend_u_get_hash_value(IS_UNICODE, ZSTR(ustr), ulen + 1);
+ }
+#else
+ /* For BC we have to check whether the key is numeric and use it like this */
+ if ((meta->zend_hash_keys[i].is_numeric =
+ mysqlnd_is_key_numeric(field_packet.metadata->name,
+ field_packet.metadata->name_length + 1,
+ &idx)))
+ {
+ meta->zend_hash_keys[i].key = idx;
+ } else {
+ meta->zend_hash_keys[i].key =
+ zend_get_hash_value(field_packet.metadata->name,
+ field_packet.metadata->name_length + 1);
}
+#endif
}
PACKET_FREE_ALLOCA(field_packet);
sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
+ {
UChar *ustr, *tstr;
int ulen, tlen;
add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1);
efree(ustr);
efree(tstr);
- } else
-#endif
- {
- add_assoc_string_ex(return_value, mysqlnd_stats_values_names[i].s,
- mysqlnd_stats_values_names[i].l + 1, tmp, 1);
}
+#else
+ add_assoc_string_ex(return_value, mysqlnd_stats_values_names[i].s,
+ mysqlnd_stats_values_names[i].l + 1, tmp, 1);
+#endif
}
}
/* }}} */
zstr string_key;
uint string_key_len;
ulong num_key;
+ int s_len;
char *s = NULL;
+
TSRMLS_FETCH();
zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, &string_key_len, &num_key, 0, &pos_values);
convert_to_string(*values_entry);
-
- if (UG(unicode)) {
- int s_len;
- if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
- &s, &s_len, string_key.u, string_key_len TSRMLS_CC) == SUCCESS) {
- php_info_print_table_row(2, s, Z_STRVAL_PP(values_entry));
- }
- if (s) {
- mnd_efree(s);
- }
- } else {
- php_info_print_table_row(2, string_key.s, Z_STRVAL_PP(values_entry));
+
+ if (zend_unicode_to_string(ZEND_U_CONVERTER(UG(runtime_encoding_conv)),
+ &s, &s_len, string_key.u, string_key_len TSRMLS_CC) == SUCCESS) {
+ php_info_print_table_row(2, s, Z_STRVAL_PP(values_entry));
+ }
+ if (s) {
+ mnd_efree(s);
}
zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values);
if (is_callable_replace) {
if (Z_TYPE_P(replace) != IS_ARRAY && Z_TYPE_P(replace) != IS_OBJECT) {
- convert_to_text(replace);
+ convert_to_unicode(replace);
}
if (!zend_is_callable(replace, 0, &callback_name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires argument 2, '%R', to be a valid callback", Z_TYPE(callback_name), Z_UNIVAL(callback_name));