summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pgsql/config.m41
-rw-r--r--ext/pgsql/pgsql.c11
-rw-r--r--ext/pgsql/php_pgsql.h3
3 files changed, 13 insertions, 2 deletions
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
index 3139eaa76a..d5a2f9e0ab 100644
--- a/ext/pgsql/config.m4
+++ b/ext/pgsql/config.m4
@@ -29,6 +29,7 @@ if test "$PHP_PGSQL" != "no"; then
old_LDFLAGS="$LDFLAGS"
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,[ ]))
LIBS="$old_LIBS"
LDFLAGS="$old_LDFLAGS"
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index e8f546768b..0a533c8a77 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1127,6 +1127,7 @@ PHP_FUNCTION(pg_getlastoid)
RETURN_FALSE;
}
pgsql_result = pg_result->result;
+#ifndef HAVE_PQOIDVALUE
return_value->value.str.val = (char *) PQoidStatus(pgsql_result);
if (return_value->value.str.val) {
return_value->value.str.len = strlen(return_value->value.str.val);
@@ -1134,7 +1135,15 @@ PHP_FUNCTION(pg_getlastoid)
return_value->type = IS_STRING;
} else {
return_value->value.str.val = empty_string;
- }
+ }
+#else
+ return_value->value.lval = (int) PQoidValue(pgsql_result);
+ if (return_value->value.lval == InvalidOid) {
+ RETURN_FALSE;
+ } else {
+ return_value->type = IS_LONG;
+ }
+#endif
}
/* }}} */
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index f0ec320aed..559a0249fe 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -43,7 +43,8 @@ extern zend_module_entry pgsql_module_entry;
#define pgsql_module_ptr &pgsql_module_entry
#ifdef PHP_PGSQL_PRIVATE
-
+#undef SOCKET_SIZE_TYPE
+#include <postgres.h>
#include <libpq-fe.h>
#if (WIN32||WINNT)