diff options
author | Andrey Hristov <andrey@php.net> | 2010-08-12 12:02:02 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2010-08-12 12:02:02 +0000 |
commit | 92ef63a07b04bb85d6587b2905d068ce8a781061 (patch) | |
tree | 4ce90d8821ccc1673b4d42539285049f93c46bc3 /ext/mysqlnd/mysqlnd_ps_codec.c | |
parent | 8bf7114691540f29e6a07a34231fdf536652c1b8 (diff) | |
download | php-git-92ef63a07b04bb85d6587b2905d068ce8a781061.tar.gz |
Switch from using PHP_MAJOR_VERSION to separate define for
unicode. Unicode is no more, but these are "bookmarks" where
to change mysqlnd, if Unicode becomes trendy again.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_ps_codec.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_ps_codec.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 673cfacb5a..a0e6c0050e 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -117,7 +117,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field, } if (tmp_len) { -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE if (as_unicode) { DBG_INF("stringify"); ZVAL_UTF8_STRINGL(zv, tmp, tmp_len, ZSTR_DUPLICATE); @@ -265,12 +265,12 @@ void ps_fetch_time(zval *zv, const MYSQLND_FIELD * const field, length = spprintf(&to, 0, "%s%02u:%02u:%02u", (t.neg ? "-" : ""), t.hour, t.minute, t.second); DBG_INF_FMT("%s", to); -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE if (!as_unicode) { #endif ZVAL_STRINGL(zv, to, length, 1); efree(to); /* allocated by spprintf */ -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE } else { ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE); } @@ -316,12 +316,12 @@ void ps_fetch_date(zval *zv, const MYSQLND_FIELD * const field, length = spprintf(&to, 0, "%04u-%02u-%02u", t.year, t.month, t.day); DBG_INF_FMT("%s", to); -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE if (!as_unicode) { #endif ZVAL_STRINGL(zv, to, length, 1); efree(to); /* allocated by spprintf */ -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE } else { ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE); } @@ -375,12 +375,12 @@ void ps_fetch_datetime(zval *zv, const MYSQLND_FIELD * const field, t.year, t.month, t.day, t.hour, t.minute, t.second); DBG_INF_FMT("%s", to); -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE if (!as_unicode) { #endif ZVAL_STRINGL(zv, to, length, 1); efree(to); /* allocated by spprintf */ -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE } else { ZVAL_UTF8_STRINGL(zv, to, length, ZSTR_AUTOFREE); } @@ -403,10 +403,7 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field, unsigned long length = php_mysqlnd_net_field_length(row); DBG_ENTER("ps_fetch_string"); DBG_INF_FMT("len = %lu", length); -#if PHP_MAJOR_VERSION < 6 - DBG_INF("copying from the row buffer"); - ZVAL_STRINGL(zv, (char *)*row, length, 1); -#else +#if MYSQLND_UNICODE if (field->charsetnr == MYSQLND_BINARY_CHARSET_NR) { DBG_INF("Binary charset"); ZVAL_STRINGL(zv, (char *)*row, length, 1); @@ -414,6 +411,9 @@ void ps_fetch_string(zval *zv, const MYSQLND_FIELD * const field, DBG_INF_FMT("copying from the row buffer"); ZVAL_UTF8_STRINGL(zv, (char*)*row, length, ZSTR_DUPLICATE); } +#else + DBG_INF("copying from the row buffer"); + ZVAL_STRINGL(zv, (char *)*row, length, 1); #endif (*row) += length; @@ -704,10 +704,10 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar break; case MYSQL_TYPE_VAR_STRING: data_size += 8; /* max 8 bytes for size */ -#if PHP_MAJOR_VERSION < 6 - if (Z_TYPE_P(the_var) != IS_STRING) -#elif PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE if (Z_TYPE_P(the_var) != IS_STRING || Z_TYPE_P(the_var) == IS_UNICODE) +#else + if (Z_TYPE_P(the_var) != IS_STRING) #endif { if (!copies || !copies[i]) { @@ -717,7 +717,7 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar } } the_var = copies[i]; -#if PHP_MAJOR_VERSION >= 6 +#if MYSQLND_UNICODE if (Z_TYPE_P(the_var) == IS_UNICODE) { zval_unicode_to_string_ex(the_var, UG(utf8_conv) TSRMLS_CC); } |