--- /dev/null
+language: c
+
+addons:
+ postgresql: "9.3"
+
+before_install:
+ - sudo apt-get update -qq
+ - sudo apt-get install -qq libpq-dev
+
+before_script:
+ - sudo ./travis/compile-php.sh
+ - sudo ./travis/compile-raphf.sh
+ - sudo ./travis/compile-ext.sh
+ - sudo ./travis/configure-postgres.sh
+
+script:
+ - REPORT_EXIT_STATUS=1 $HOME/bin/php ./run-tests.php -p $HOME/bin/php --show-diff
--- /dev/null
+pecl/pq
+=======
+
+[![Build Status](https://travis-ci.org/php/pecl-database-pq.svg?branch=master)](https://travis-ci.org/php/pecl-database-pq)
+
+About
+-----
+
+This is a modern binding to the mature [libpq](http://www.postgresql.org/docs/current/static/libpq.html), the official PostgreSQL C-client library.
+
+Highlights:
+
+- Nearly 100% support for asynchronous usage.
+- Extended type support by pg_type.
+- Fetching simple multi-dimensional array maps.
+- Working [Gateway implementation](https://github.com/m6w6/pq-gateway).
+
+Installation
+------------
+
+This extension is hosted at [PECL](http://pecl.php.net/) and can be installed with [PEAR](http://pear.php.net/)'s `pecl` command:
+
+ # pecl install pq
+
+Dependencies
+------------
+
+This extension unconditionally depends on the pre-loaded presence of the following PHP extensions:
+
+- [raphf](http://pecl.php.net/package/raphf)
+- [spl](http://php.net/spl)
+
+Documentation
+-------------
+
+Documentation is available [here](http://devel-m6w6.rhcloud.com/mdref/pq).
[ --with-pq[=DIR] Include libpq support])
if test "$PHP_PQ" != "no"; then
- SEARCH_PATH="/usr/local /usr /opt"
+ SEARCH_PATH="/usr/local /usr /usr/include/postgresql /opt"
if test "$PHP_PQ" != "yes"; then
SEARCH_PATH="$PHP_PQ $SEARCH_PATH"
fi
for i in $SEARCH_PATH; do
+ AC_MSG_CHECKING(for $i/libpq-events.h)
+ if test -f "$i/libpq-events.h"; then
+ PQ_DIR=$i
+ AC_MSG_RESULT(yep)
+ break
+ fi
+ AC_MSG_RESULT(nope)
+
AC_MSG_CHECKING(for $i/include/libpq-events.h)
if test -f "$i/include/libpq-events.h"; then
- PQ_DIR=$i
+ PQ_DIR=$i/include
AC_MSG_RESULT(yep)
break
fi
if test -z "$PQ_DIR"; then
AC_MSG_ERROR(could not find include/libpq-events.h)
fi
- PHP_ADD_INCLUDE($PQ_DIR/include)
+ PHP_ADD_INCLUDE($PQ_DIR)
ifdef([AC_PROG_EGREP], [
AC_PROG_EGREP
dnl
AC_DEFUN([PQ_CHECK_CONST], [
AC_MSG_CHECKING(for $1)
- if $EGREP -q $1 $PQ_DIR/include/libpq-fe.h; then
+ if $EGREP -q $1 $PQ_DIR/libpq-fe.h; then
AC_DEFINE(HAVE_$1, 1, [Have $1])
AC_MSG_RESULT(yep)
else
$c = new pq\Connection(PQ_DSN);
$c->exec("DROP TABLE IF EXISTS test CASCADE");
+$c->exec("SET client_min_messages TO NOTICE");
$c->on(pq\Connection::EVENT_NOTICE, function($c, $notice) {
echo "Got notice: $notice\n";
});
--- /dev/null
+#!/bin/sh -x
+
+set -e
+
+$HOME/bin/phpize
+./configure --with-php-config=$HOME/bin/php-config --with-pq
+
+make -j2 --quiet install
+
+echo 'extension=pq.so' > $HOME/php.d/20-pq.ini
--- /dev/null
+#!/bin/sh -x
+
+set -e
+TARGET_PHP_REF="PHP-5.6"
+
+mkdir -p $HOME/php
+mkdir -p $HOME/php.d
+git clone --depth=1 --branch=$TARGET_PHP_REF https://github.com/php/php-src $HOME/php/src
+
+cd $HOME/php/src
+./buildconf --force
+./configure --prefix=$HOME --with-config-file-scan-dir=$HOME/php.d --disable-all --enable-maintainer-zts --enable-json --with-mhash
+
+make -j2 --quiet install
--- /dev/null
+#!/bin/sh -x
+
+set -e
+
+git clone --depth 1 https://github.com/php/pecl-php-raphf $HOME/raphf
+cd $HOME/raphf
+
+$HOME/bin/phpize
+./configure --with-php-config=$HOME/bin/php-config --with-pq
+
+make -j2 --quiet install
+
+echo 'extension=raphf.so' > $HOME/php.d/10-raphf.ini
--- /dev/null
+#!/bin/sh -x
+
+psql -c 'create database pq_test;' -U postgres
+echo '<?php const PQ_DSN = "postgres://postgres@localhost/pq_test";' > ./tests/_setup.inc