[mod_pgsql] Fix build by using PG_VERSION_NUM provided by libpq instead of using POSTGRESQL_MAJOR_VERSION detected by freeswitch configure.

This commit is contained in:
Andrey Volk 2021-12-31 00:33:41 +03:00
parent f9bb8940c2
commit 92d2e0b136
1 changed files with 7 additions and 6 deletions

View 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;