mirror of
https://github.com/danog/ext-pq.git
synced 2024-12-11 08:59:45 +01:00
Merge branch 'meta/travis'
* meta/travis: Add README.md for github Add travis config Ensure server will report notices when test expects them Build improvements
This commit is contained in:
commit
db9b923fd2
17
.travis.yml
Normal file
17
.travis.yml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
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
|
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
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).
|
16
config9.m4
16
config9.m4
@ -2,14 +2,22 @@ PHP_ARG_WITH(pq, [whether to enable libpq (PostgreSQL) support],
|
|||||||
[ --with-pq[=DIR] Include libpq support])
|
[ --with-pq[=DIR] Include libpq support])
|
||||||
|
|
||||||
if test "$PHP_PQ" != "no"; then
|
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
|
if test "$PHP_PQ" != "yes"; then
|
||||||
SEARCH_PATH="$PHP_PQ $SEARCH_PATH"
|
SEARCH_PATH="$PHP_PQ $SEARCH_PATH"
|
||||||
fi
|
fi
|
||||||
for i in $SEARCH_PATH; do
|
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)
|
AC_MSG_CHECKING(for $i/include/libpq-events.h)
|
||||||
if test -f "$i/include/libpq-events.h"; then
|
if test -f "$i/include/libpq-events.h"; then
|
||||||
PQ_DIR=$i
|
PQ_DIR=$i/include
|
||||||
AC_MSG_RESULT(yep)
|
AC_MSG_RESULT(yep)
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@ -19,7 +27,7 @@ if test "$PHP_PQ" != "no"; then
|
|||||||
if test -z "$PQ_DIR"; then
|
if test -z "$PQ_DIR"; then
|
||||||
AC_MSG_ERROR(could not find include/libpq-events.h)
|
AC_MSG_ERROR(could not find include/libpq-events.h)
|
||||||
fi
|
fi
|
||||||
PHP_ADD_INCLUDE($PQ_DIR/include)
|
PHP_ADD_INCLUDE($PQ_DIR)
|
||||||
|
|
||||||
ifdef([AC_PROG_EGREP], [
|
ifdef([AC_PROG_EGREP], [
|
||||||
AC_PROG_EGREP
|
AC_PROG_EGREP
|
||||||
@ -32,7 +40,7 @@ if test "$PHP_PQ" != "no"; then
|
|||||||
dnl
|
dnl
|
||||||
AC_DEFUN([PQ_CHECK_CONST], [
|
AC_DEFUN([PQ_CHECK_CONST], [
|
||||||
AC_MSG_CHECKING(for $1)
|
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_DEFINE(HAVE_$1, 1, [Have $1])
|
||||||
AC_MSG_RESULT(yep)
|
AC_MSG_RESULT(yep)
|
||||||
else
|
else
|
||||||
|
@ -10,6 +10,7 @@ include "_setup.inc";
|
|||||||
|
|
||||||
$c = new pq\Connection(PQ_DSN);
|
$c = new pq\Connection(PQ_DSN);
|
||||||
$c->exec("DROP TABLE IF EXISTS test CASCADE");
|
$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) {
|
$c->on(pq\Connection::EVENT_NOTICE, function($c, $notice) {
|
||||||
echo "Got notice: $notice\n";
|
echo "Got notice: $notice\n";
|
||||||
});
|
});
|
||||||
|
10
travis/compile-ext.sh
Executable file
10
travis/compile-ext.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/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
|
14
travis/compile-php.sh
Executable file
14
travis/compile-php.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/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
|
13
travis/compile-raphf.sh
Executable file
13
travis/compile-raphf.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/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
|
4
travis/configure-postgres.sh
Executable file
4
travis/configure-postgres.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh -x
|
||||||
|
|
||||||
|
psql -c 'create database pq_test;' -U postgres
|
||||||
|
echo '<?php const PQ_DSN = "postgres://postgres@localhost/pq_test";' > ./tests/_setup.inc
|
Loading…
Reference in New Issue
Block a user