From: Yasuo Ohgaki Date: Thu, 25 Apr 2002 07:09:45 +0000 (+0000) Subject: Revert last 2 commits. X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~433 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4c943ee7b70f9d907cad63a416cccc478ccde6d;p=php Revert last 2 commits. # Most PostgreSQL users should enable multibyte support ;) --- diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 1ba7e2d727..442f669f32 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -137,8 +137,10 @@ function_entry pgsql_functions[] = { PHP_FE(pg_escape_string,NULL) PHP_FE(pg_escape_bytea, NULL) #endif +#if HAVE_PQCLIENTENCODING PHP_FE(pg_client_encoding, NULL) PHP_FE(pg_set_client_encoding, NULL) +#endif /* misc function */ PHP_FE(pg_metadata, NULL) PHP_FE(pg_convert, NULL) @@ -170,8 +172,10 @@ function_entry pgsql_functions[] = { PHP_FALIAS(pg_lowrite, pg_lo_write, NULL) PHP_FALIAS(pg_loimport, pg_lo_import, NULL) PHP_FALIAS(pg_loexport, pg_lo_export, NULL) +#if HAVE_PQCLIENTENCODING PHP_FALIAS(pg_clientencoding, pg_client_encoding, NULL) PHP_FALIAS(pg_setclientencoding, pg_set_client_encoding, NULL) +#endif {NULL, NULL, NULL} }; /* }}} */ @@ -1339,7 +1343,7 @@ PHP_FUNCTION(pg_fetch_array) } /* }}} */ -/* {{{ proto object pg_fetch_object(resource result [, int row]) +/* {{{ proto object pg_fetch_object(resource result [, int row[, int result_type]]) Fetch a row as an object */ PHP_FUNCTION(pg_fetch_object) { @@ -2129,6 +2133,7 @@ PHP_FUNCTION(pg_lo_tell) } /* }}} */ +#ifdef HAVE_PQCLIENTENCODING /* {{{ proto int pg_set_client_encoding([resource connection,] string encoding) Set client encoding */ PHP_FUNCTION(pg_set_client_encoding) @@ -2154,18 +2159,13 @@ PHP_FUNCTION(pg_set_client_encoding) WRONG_PARAM_COUNT; break; } - -#ifdef HAVE_PQCLIENTENCODING + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); convert_to_string_ex(encoding); Z_LVAL_P(return_value) = PQsetClientEncoding(pgsql, Z_STRVAL_PP(encoding)); Z_TYPE_P(return_value) = IS_LONG; -#else - php_error(E_NOTICE, "%s() PHP is compiled with libpq without multibyte PQsetClientEncoding" - get_active_function_name(TSRMLS_C)); - RETURN_LONG(-1); -#endif + } /* }}} */ @@ -2192,7 +2192,6 @@ PHP_FUNCTION(pg_client_encoding) break; } -#ifdef HAVE_PQCLIENTENCODING ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); /* Just do the same as found in PostgreSQL sources... */ @@ -2206,13 +2205,9 @@ PHP_FUNCTION(pg_client_encoding) Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_STRVAL_P(return_value) = (char *) estrdup(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; -#else - php_error(E_NOTICE, "%s() PHP is compiled with libpq without PQclientEncoding" - get_active_function_name(TSRMLS_C)); - RETURN_STRING("SQL_ASCII",1); -#endif } /* }}} */ +#endif #define COPYBUFSIZ 8192