(charset = mysqlnd_find_charset_name(conn->options.charset_name)))
{
auth_packet->charset_no = charset->nr;
+ } else {
#if PHP_MAJOR_VERSION >= 6
- } else if (UG(unicode)) {
auth_packet->charset_no = 200;/* utf8 - swedish collation, check mysqlnd_charset.c */
-#endif
- } else {
+#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;
+#if PHP_MAJOR_VERSION >= 6
+ UChar *ustr;
+ int ulen;
+#endif
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);
mysqlnd_array_init(return_value, STAT_LAST);
for (i = 0; i < STAT_LAST; i++) {
+#if PHP_MAJOR_VERSION >= 6
+ UChar *ustr, *tstr;
+ int ulen, tlen;
+#endif
char tmp[22];
sprintf((char *)&tmp, MYSQLND_LLU_SPEC, stats->values[i]);
#if PHP_MAJOR_VERSION >= 6
- if (UG(unicode)) {
- UChar *ustr, *tstr;
- int ulen, tlen;
-
- zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysqlnd_stats_values_names[i].s,
- mysqlnd_stats_values_names[i].l + 1 TSRMLS_CC);
- zend_string_to_unicode(UG(utf8_conv), &tstr, &tlen, tmp, strlen(tmp) + 1 TSRMLS_CC);
- 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);
- }
+ zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, mysqlnd_stats_values_names[i].s,
+ mysqlnd_stats_values_names[i].l + 1 TSRMLS_CC);
+ zend_string_to_unicode(UG(utf8_conv), &tstr, &tlen, tmp, strlen(tmp) + 1 TSRMLS_CC);
+ add_u_assoc_unicode_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen, tstr, 1);
+ efree(ustr);
+ efree(tstr);
+#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;
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);