fix build with postgresql < 9.3
authorMichael Wallner <mike@php.net>
Fri, 20 May 2016 08:43:58 +0000 (10:43 +0200)
committerMichael Wallner <mike@php.net>
Fri, 20 May 2016 08:43:58 +0000 (10:43 +0200)
src/php_pqres.c

index 6cc99545c5e0e259f8ca684833f7acac98801304..2b983685658730bc5e024a029648138e241a181c 100644 (file)
@@ -519,23 +519,57 @@ static void php_pqres_object_read_diag(zval *object, void *o, zval *return_value
                char code;
                const char *const name;
        } diag[] = {
+#ifdef PG_DIAG_SEVERITY
                        {PG_DIAG_SEVERITY,                      "severity"},
+#endif
+#ifdef PG_DIAG_SQLSTATE
                        {PG_DIAG_SQLSTATE,                      "sqlstate"},
+#endif
+#ifdef PG_DIAG_MESSAGE_PRIMARY
                        {PG_DIAG_MESSAGE_PRIMARY,       "message_primary"},
+#endif
+#ifdef PG_DIAG_MESSAGE_DETAIL
                        {PG_DIAG_MESSAGE_DETAIL,        "message_detail"},
+#endif
+#ifdef PG_DIAG_MESSAGE_HINT
                        {PG_DIAG_MESSAGE_HINT,          "message_hint"},
+#endif
+#ifdef PG_DIAG_STATEMENT_POSITION
                        {PG_DIAG_STATEMENT_POSITION,"statement_position"},
+#endif
+#ifdef PG_DIAG_INTERNAL_POSITION
                        {PG_DIAG_INTERNAL_POSITION,     "internal_position"},
+#endif
+#ifdef PG_DIAG_INTERNAL_QUERY
                        {PG_DIAG_INTERNAL_QUERY,        "internal_query"},
+#endif
+#ifdef PG_DIAG_CONTEXT
                        {PG_DIAG_CONTEXT,                       "context"},
+#endif
+#ifdef PG_DIAG_SCHEMA_NAME
                        {PG_DIAG_SCHEMA_NAME,           "schema_name"},
+#endif
+#ifdef PG_DIAG_TABLE_NAME
                        {PG_DIAG_TABLE_NAME,            "table_name"},
+#endif
+#ifdef PG_DIAG_COLUMN_NAME
                        {PG_DIAG_COLUMN_NAME,           "column_name"},
+#endif
+#ifdef PG_DIAG_DATATYPE_NAME
                        {PG_DIAG_DATATYPE_NAME,         "datatype_name"},
+#endif
+#ifdef PG_DIAG_CONSTRAINT_NAME
                        {PG_DIAG_CONSTRAINT_NAME,       "constraint_name"},
+#endif
+#ifdef PG_DIAG_SOURCE_FILE
                        {PG_DIAG_SOURCE_FILE,           "source_file"},
+#endif
+#ifdef PG_DIAG_SOURCE_LINE
                        {PG_DIAG_SOURCE_LINE,           "source_line"},
-                       {PG_DIAG_SOURCE_FUNCTION,       "source_function"}
+#endif
+#ifdef PG_DIAG_SOURCE_FUNCTION
+                       {PG_DIAG_SOURCE_FUNCTION,       "source_function"},
+#endif
        };
 
        array_init_size(return_value, 32);