summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--33.patch139
-rw-r--r--php-pecl-pq.spec20
2 files changed, 152 insertions, 7 deletions
diff --git a/33.patch b/33.patch
new file mode 100644
index 0000000..28a7491
--- /dev/null
+++ b/33.patch
@@ -0,0 +1,139 @@
+From b71a5226c19caba947c99500385023fd043f6999 Mon Sep 17 00:00:00 2001
+From: Michael Wallner <mike@php.net>
+Date: Tue, 18 Jun 2019 12:02:30 +0200
+Subject: [PATCH] fix issue #19: Failed test with PgSQL < 9.3
+
+---
+ src/php_pqres.c | 102 ++++++++++++++++++++++++++++--------------------
+ 1 file changed, 60 insertions(+), 42 deletions(-)
+
+diff --git a/src/php_pqres.c b/src/php_pqres.c
+index 849f8bf..3427b38 100644
+--- a/src/php_pqres.c
++++ b/src/php_pqres.c
+@@ -491,65 +491,83 @@ static void php_pqres_object_read_error_message(zval *object, void *o, zval *ret
+ }
+ }
+
+-static void php_pqres_object_read_diag(zval *object, void *o, zval *return_value)
+-{
+- php_pqres_object_t *obj = o;
+- int i;
+- struct {
+- char code;
+- const char *const name;
+- } diag[] = {
+-#ifdef PG_DIAG_SEVERITY
+- {PG_DIAG_SEVERITY, "severity"},
++#ifndef PG_DIAG_SEVERITY
++# define PG_DIAG_SEVERITY 'S'
+ #endif
+-#ifdef PG_DIAG_SQLSTATE
+- {PG_DIAG_SQLSTATE, "sqlstate"},
++#ifndef PG_DIAG_SQLSTATE
++# define PG_DIAG_SQLSTATE 'C'
+ #endif
+-#ifdef PG_DIAG_MESSAGE_PRIMARY
+- {PG_DIAG_MESSAGE_PRIMARY, "message_primary"},
++#ifndef PG_DIAG_MESSAGE_PRIMARY
++# define PG_DIAG_MESSAGE_PRIMARY 'M'
+ #endif
+-#ifdef PG_DIAG_MESSAGE_DETAIL
+- {PG_DIAG_MESSAGE_DETAIL, "message_detail"},
++#ifndef PG_DIAG_MESSAGE_DETAIL
++# define PG_DIAG_MESSAGE_DETAIL 'D'
+ #endif
+-#ifdef PG_DIAG_MESSAGE_HINT
+- {PG_DIAG_MESSAGE_HINT, "message_hint"},
++#ifndef PG_DIAG_MESSAGE_HINT
++# define PG_DIAG_MESSAGE_HINT 'H'
+ #endif
+-#ifdef PG_DIAG_STATEMENT_POSITION
+- {PG_DIAG_STATEMENT_POSITION,"statement_position"},
++#ifndef PG_DIAG_STATEMENT_POSITION
++# define PG_DIAG_STATEMENT_POSITION 'P'
+ #endif
+-#ifdef PG_DIAG_INTERNAL_POSITION
+- {PG_DIAG_INTERNAL_POSITION, "internal_position"},
++#ifndef PG_DIAG_INTERNAL_POSITION
++# define PG_DIAG_INTERNAL_POSITION 'p'
+ #endif
+-#ifdef PG_DIAG_INTERNAL_QUERY
+- {PG_DIAG_INTERNAL_QUERY, "internal_query"},
++#ifndef PG_DIAG_INTERNAL_QUERY
++# define PG_DIAG_INTERNAL_QUERY 'q'
+ #endif
+-#ifdef PG_DIAG_CONTEXT
+- {PG_DIAG_CONTEXT, "context"},
++#ifndef PG_DIAG_CONTEXT
++# define PG_DIAG_CONTEXT 'W'
+ #endif
+-#ifdef PG_DIAG_SCHEMA_NAME
+- {PG_DIAG_SCHEMA_NAME, "schema_name"},
++#ifndef PG_DIAG_SCHEMA_NAME
++# define PG_DIAG_SCHEMA_NAME 's'
+ #endif
+-#ifdef PG_DIAG_TABLE_NAME
+- {PG_DIAG_TABLE_NAME, "table_name"},
++#ifndef PG_DIAG_TABLE_NAME
++# define PG_DIAG_TABLE_NAME 't'
+ #endif
+-#ifdef PG_DIAG_COLUMN_NAME
+- {PG_DIAG_COLUMN_NAME, "column_name"},
++#ifndef PG_DIAG_COLUMN_NAME
++# define PG_DIAG_COLUMN_NAME 'c'
+ #endif
+-#ifdef PG_DIAG_DATATYPE_NAME
+- {PG_DIAG_DATATYPE_NAME, "datatype_name"},
++#ifndef PG_DIAG_DATATYPE_NAME
++# define PG_DIAG_DATATYPE_NAME 'd'
+ #endif
+-#ifdef PG_DIAG_CONSTRAINT_NAME
+- {PG_DIAG_CONSTRAINT_NAME, "constraint_name"},
++#ifndef PG_DIAG_CONSTRAINT_NAME
++# define PG_DIAG_CONSTRAINT_NAME 'n'
+ #endif
+-#ifdef PG_DIAG_SOURCE_FILE
+- {PG_DIAG_SOURCE_FILE, "source_file"},
++#ifndef PG_DIAG_SOURCE_FILE
++# define PG_DIAG_SOURCE_FILE 'F'
+ #endif
+-#ifdef PG_DIAG_SOURCE_LINE
+- {PG_DIAG_SOURCE_LINE, "source_line"},
++#ifndef PG_DIAG_SOURCE_LINE
++# define PG_DIAG_SOURCE_LINE 'L'
+ #endif
+-#ifdef PG_DIAG_SOURCE_FUNCTION
+- {PG_DIAG_SOURCE_FUNCTION, "source_function"},
++#ifndef PG_DIAG_SOURCE_FUNCTION
++# define PG_DIAG_SOURCE_FUNCTION 'R'
+ #endif
++
++static void php_pqres_object_read_diag(zval *object, void *o, zval *return_value)
++{
++ php_pqres_object_t *obj = o;
++ int i;
++ struct {
++ char code;
++ const char *const name;
++ } diag[] = {
++ {PG_DIAG_SEVERITY, "severity"},
++ {PG_DIAG_SQLSTATE, "sqlstate"},
++ {PG_DIAG_MESSAGE_PRIMARY, "message_primary"},
++ {PG_DIAG_MESSAGE_DETAIL, "message_detail"},
++ {PG_DIAG_MESSAGE_HINT, "message_hint"},
++ {PG_DIAG_STATEMENT_POSITION,"statement_position"},
++ {PG_DIAG_INTERNAL_POSITION, "internal_position"},
++ {PG_DIAG_INTERNAL_QUERY, "internal_query"},
++ {PG_DIAG_CONTEXT, "context"},
++ {PG_DIAG_SCHEMA_NAME, "schema_name"},
++ {PG_DIAG_TABLE_NAME, "table_name"},
++ {PG_DIAG_COLUMN_NAME, "column_name"},
++ {PG_DIAG_DATATYPE_NAME, "datatype_name"},
++ {PG_DIAG_CONSTRAINT_NAME, "constraint_name"},
++ {PG_DIAG_SOURCE_FILE, "source_file"},
++ {PG_DIAG_SOURCE_LINE, "source_line"},
++ {PG_DIAG_SOURCE_FUNCTION, "source_function"},
+ };
+
+ array_init_size(return_value, 32);
diff --git a/php-pecl-pq.spec b/php-pecl-pq.spec
index a9bc90a..5cab4f7 100644
--- a/php-pecl-pq.spec
+++ b/php-pecl-pq.spec
@@ -35,12 +35,14 @@ Version: 2.1.5
Release: 0.8.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
%else
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
%endif
License: BSD
URL: http://pecl.php.net/package/%{pecl_name}
+Patch0: https://patch-diff.githubusercontent.com/raw/m6w6/ext-pq/pull/33.patch
+
%if 0%{?fedora} >= 29 && 0%{?rhel} >= 8
BuildRequires: libpq-devel > 9
%else
@@ -82,9 +84,13 @@ Obsoletes: php72u-pecl-%{pecl_name} <= %{version}
Obsoletes: php72w-pecl-%{pecl_name} <= %{version}
%endif
%if "%{php_version}" > "7.3"
-Obsoletes: php73u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php73-pecl-%{pecl_name} <= %{version}
Obsoletes: php73w-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "7.4"
+Obsoletes: php74-pecl-%{pecl_name} <= %{version}
+Obsoletes: php74w-pecl-%{pecl_name} <= %{version}
+%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
@@ -123,6 +129,8 @@ sed -e '/role="test"/d' \
-i package.xml
cd NTS
+%patch0 -p1
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_PQ_VERSION/{s/.* "//;s/".*$//;p}' php_pq.h)
if test "x${extver}" != "x%{version}%{?prever}"; then
@@ -210,11 +218,6 @@ fi
: ignore tests with erratic results
rm ?TS/tests/cancel001.phpt
-if ! pkg-config libpq --atleast-version=9.3; then
- : ignore some tests only because of "diag" content
- rm ?TS/tests/{async003,async004,async005,async006}.phpt
-fi
-
OPT="-n"
[ -f %{php_extdir}/json.so ] && OPT="$OPT -d extension=json.so"
[ -f %{php_extdir}/raphf.so ] && OPT="$OPT -d extension=raphf.so"
@@ -297,6 +300,9 @@ exit $RET
%changelog
+* Wed Jun 19 2019 Remi Collet <remi@remirepo.net> - 2.1.5-2
+- test build for https://github.com/m6w6/ext-pq/pull/33
+
* Mon Jan 14 2019 Remi Collet <remi@remirepo.net> - 2.1.5-1
- update to 2.1.5