Handle building on different PGSQL versions and update error message in Sofia.
This commit is contained in:
parent
bf7578550d
commit
1fe96ac38c
|
@ -406,7 +406,14 @@ if test "$PG_CONFIG" != "no"; then
|
|||
POSTGRESQL_CXXFLAGS="`$PG_CONFIG --cppflags` -I`$PG_CONFIG --includedir`"
|
||||
POSTGRESQL_LDFLAGS="`$PG_CONFIG --ldflags` -L`$PG_CONFIG --libdir` -lpq"
|
||||
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
|
||||
POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL ([0-9]+).[0-9]+.[0-9]+#\1#'`
|
||||
POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL [0-9]+.([0-9]+).[0-9]+#\1#'`
|
||||
POSTGRESQL_PATCH_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL [0-9]+.[0-9]+.([0-9]+)#\1#'`
|
||||
AC_DEFINE([SWITCH_HAVE_PGSQL], [1], [Define to 1 if PostgreSQL libraries are available])
|
||||
AC_DEFINE_UNQUOTED([POSTGRESQL_VERSION], "${POSTGRESQL_VERSION}", [Specifies the version of PostgreSQL we are linking against])
|
||||
AC_DEFINE_UNQUOTED([POSTGRESQL_MAJOR_VERSION], ${POSTGRESQL_MAJOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
|
||||
AC_DEFINE_UNQUOTED([POSTGRESQL_MINOR_VERSION], ${POSTGRESQL_MINOR_VERSION}, [Specifies the version of PostgreSQL we are linking against])
|
||||
AC_DEFINE_UNQUOTED([POSTGRESQL_PATCH_VERSION], ${POSTGRESQL_PATCH_VERSION}, [Specifies the version of PostgreSQL we are linking against])
|
||||
AC_CHECK_LIB([pq], [PQgetvalue],, AC_MSG_ERROR([no usable libpq; please install PostgreSQL devel package or equivalent]))
|
||||
AC_MSG_RESULT([yes])
|
||||
SWITCH_AM_CXXFLAGS="$POSTGRESQL_CXXFLAGS $SWITCH_AM_CXXFLAGS"
|
||||
|
|
|
@ -4423,14 +4423,14 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NEITHER ODBC NOR PGSQL ARE AVAILABLE!\n");
|
||||
}
|
||||
} else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
|
||||
}
|
||||
} else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
|
||||
}
|
||||
} else if (!strcasecmp(var, "registration-thread-frequency")) {
|
||||
profile->ireg_seconds = atoi(val);
|
||||
if (profile->ireg_seconds < 0) {
|
||||
|
|
|
@ -254,6 +254,10 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_next_result_timed(switch_pgsq
|
|||
*result_out = res;
|
||||
res->status = PQresultStatus(res->result);
|
||||
switch(res->status) {
|
||||
#if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 2
|
||||
case PGRES_SINGLE_TUPLE:
|
||||
/* Added in PostgreSQL 9.2 */
|
||||
#endif
|
||||
case PGRES_TUPLES_OK:
|
||||
{
|
||||
res->rows = PQntuples(res->result);
|
||||
|
@ -261,6 +265,10 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_next_result_timed(switch_pgsq
|
|||
res->cols = PQnfields(res->result);
|
||||
}
|
||||
break;
|
||||
#if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 1
|
||||
case PGRES_COPY_BOTH:
|
||||
/* Added in PostgreSQL 9.1 */
|
||||
#endif
|
||||
case PGRES_COPY_OUT:
|
||||
case PGRES_COPY_IN:
|
||||
case PGRES_COMMAND_OK:
|
||||
|
|
Loading…
Reference in New Issue