1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-11-30 04:19:49 +01:00

fix check for PG constant

This commit is contained in:
Remi Collet 2014-10-17 11:01:43 +02:00
parent 775460467d
commit a9d3f4be3c
2 changed files with 13 additions and 7 deletions

View File

@ -27,15 +27,21 @@ if test "$PHP_PQ" != "no"; then
AC_CHECK_PROG(EGREP, egrep, egrep)
])
for PQ_DEF in PGRES_SINGLE_TUPLE PGRES_COPY_BOTH; do
AC_MSG_CHECKING(for $PQ_DEF)
if $EGREP -q $PQ_DEF $PQ_DIR/include/libpq-fe.h; then
AC_DEFINE([$PQ_DEF], [1], [Have $PQ_DEF])
dnl
dnl PQ_CHECK_CONST(name)
dnl
AC_DEFUN([PQ_CHECK_CONST], [
AC_MSG_CHECKING(for $1)
if $EGREP -q $1 $PQ_DIR/include/libpq-fe.h; then
AC_DEFINE(HAVE_$1, 1, [Have $1])
AC_MSG_RESULT(yep)
else
AC_MSG_RESULT(nope)
fi
done
])
PQ_CHECK_CONST(PGRES_SINGLE_TUPLE)
PQ_CHECK_CONST(PGRES_COPY_BOTH)
dnl

View File

@ -82,7 +82,7 @@ static STATUS php_pqres_iterator_valid(zend_object_iterator *i TSRMLS_DC)
switch (PQresultStatus(obj->intern->res)) {
case PGRES_TUPLES_OK:
#if HAVE_PGRES_SINGLE_TUPLE
#ifdef HAVE_PGRES_SINGLE_TUPLE
case PGRES_SINGLE_TUPLE:
#endif
if (PQntuples(obj->intern->res) <= iter->index) {
@ -1211,7 +1211,7 @@ PHP_MINIT_FUNCTION(pqres)
#ifdef HAVE_PGRES_COPY_BOTH
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("COPY_BOTH"), PGRES_COPY_BOTH TSRMLS_CC);
#endif
#if HAVE_PGRES_SINGLE_TUPLE
#ifdef HAVE_PGRES_SINGLE_TUPLE
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("SINGLE_TUPLE"), PGRES_SINGLE_TUPLE TSRMLS_CC);
#endif