summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJouni Ahto <jah@php.net>2000-07-29 04:24:11 +0000
committerJouni Ahto <jah@php.net>2000-07-29 04:24:11 +0000
commitd88fe953ae572e78356421bdd705126eef8a865a (patch)
treeb1fc842e3c0bea7ef931be220d76672453495cc4
parent90c1689cf09ea2234e89fc40a760b938044dafc7 (diff)
downloadphp-git-d88fe953ae572e78356421bdd705126eef8a865a.tar.gz
This should fix #5826.
-rw-r--r--ext/pgsql/config.m43
-rw-r--r--ext/pgsql/pgsql.c6
-rw-r--r--ext/pgsql/php_pgsql.h2
3 files changed, 10 insertions, 1 deletions
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);