]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_pgsql] Fix build by using PG_VERSION_NUM provided by libpq instead of using... 1510/head
authorAndrey Volk <andywolk@gmail.com>
Thu, 30 Dec 2021 21:33:41 +0000 (00:33 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 11 Jan 2022 15:44:36 +0000 (18:44 +0300)
src/mod/databases/mod_pgsql/mod_pgsql.c

index b638a4feae91dfab4b6d4f8ed2b2625856e0b79f..575252223b9127241537bcba3b57b6a0a9cf0383 100644 (file)
@@ -36,6 +36,7 @@
 #include <switch.h>
 
 #include <libpq-fe.h>
+#include <pg_config.h>
 
 #ifndef _WIN32
 #include <poll.h>
@@ -597,7 +598,7 @@ switch_status_t database_handle_exec_string(switch_database_interface_handle_t *
                goto done;
        } else {
                switch (result->status) {
-#if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 2
+#if PG_VERSION_NUM >= 90002
                case PGRES_SINGLE_TUPLE:
                        /* Added in PostgreSQL 9.2 */
 #endif
@@ -756,25 +757,25 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg
                *result_out = res;
                res->status = PQresultStatus(res->result);
                switch (res->status) {
-//#if (POSTGRESQL_MAJOR_VERSION == 9 && POSTGRESQL_MINOR_VERSION >= 2) || POSTGRESQL_MAJOR_VERSION > 9
+#if PG_VERSION_NUM >= 90002
                case PGRES_SINGLE_TUPLE:
                        /* Added in PostgreSQL 9.2 */
-//#endif
+#endif
                case PGRES_TUPLES_OK:
                {
                        res->rows = PQntuples(res->result);
                        res->cols = PQnfields(res->result);
                }
                break;
-//#if (POSTGRESQL_MAJOR_VERSION == 9 && POSTGRESQL_MINOR_VERSION >= 1) || POSTGRESQL_MAJOR_VERSION > 9
+#if PG_VERSION_NUM >= 90001
                case PGRES_COPY_BOTH:
                        /* Added in PostgreSQL 9.1 */
-//#endif
+#endif
                case PGRES_COPY_OUT:
                case PGRES_COPY_IN:
                case PGRES_COMMAND_OK:
                        break;
-#if POSTGRESQL_MAJOR_VERSION >= 14
+#if PG_VERSION_NUM >= 140001
                case PGRES_PIPELINE_ABORTED:
                case PGRES_PIPELINE_SYNC:
                        break;