summaryrefslogtreecommitdiffstats
path: root/33.patch
diff options
context:
space:
mode:
Diffstat (limited to '33.patch')
-rw-r--r--33.patch139
1 files changed, 139 insertions, 0 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);