From: Jouni Ahto Date: Sat, 29 Jul 2000 04:24:11 +0000 (+0000) Subject: This should fix #5826. X-Git-Tag: PRE_FILE_COMPILE_API_CHANGE~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d88fe953ae572e78356421bdd705126eef8a865a;p=php This should fix #5826. --- diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 index 895cfa6e96..dfe1cea051 100644 --- a/ext/pgsql/config.m4 +++ b/ext/pgsql/config.m4 @@ -30,7 +30,8 @@ if test "$PHP_PGSQL" != "no"; then LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR" AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ])) AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[ ])) - AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[ ])) + AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[ ])) + AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[ ])) LIBS="$old_LIBS" LDFLAGS="$old_LDFLAGS" diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index c234715707..fa009ec469 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1665,6 +1665,12 @@ PHP_FUNCTION(pg_clientencoding) ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink); + /* Just do the same as found in PostgreSQL sources... */ + +#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT +#define pg_encoding_to_char(x) "SQL_ASCII" +#endif + return_value->value.str.val = (char *) pg_encoding_to_char(PQclientEncoding(pgsql)); return_value->value.str.len = strlen(return_value->value.str.val); diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index 0cd96cac19..9101128dc8 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -85,8 +85,10 @@ PHP_FUNCTION(pg_lowrite); PHP_FUNCTION(pg_loreadall); PHP_FUNCTION(pg_loimport); PHP_FUNCTION(pg_loexport); +#if HAVE_PQCLIENTENCODING PHP_FUNCTION(pg_clientencoding); PHP_FUNCTION(pg_setclientencoding); +#endif void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent); int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);