]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow for PGRES_TUPLES_CHUNK when checking PostgreSQL status codes
authorNick Porter <nick@portercomputing.co.uk>
Tue, 8 Oct 2024 15:01:26 +0000 (16:01 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Wed, 9 Oct 2024 07:02:06 +0000 (08:02 +0100)
src/modules/rlm_sql/drivers/rlm_sql_postgresql/config.h.in
src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure
src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.ac
src/modules/rlm_sql/drivers/rlm_sql_postgresql/rlm_sql_postgresql.c

index 066224d429492841f57e9aa0b3868a4c49a7c7a4..b29078363dbb942c9049ca87ceccb7ce8eaac525 100644 (file)
@@ -6,6 +6,9 @@
 /* Whether the PGRES_SINGLE_TUPLE constant is defined */
 #undef HAVE_PGRES_SINGLE_TUPLE
 
+/* Whether the PGRES_TUPLES_CHUNK constant is defined */
+#undef HAVE_PGRES_TUPLES_CHUNK
+
 /* Whether the PGRES_PIPELINE_SYNC constant is defined */
 #undef HAVE_PGRES_PIPELINE_SYNC
 
index 7a029d4f1bd049810c481003c034b9599c850e59..5ffbb2734979928b1c938df6ac922ea66e879366 100755 (executable)
@@ -3561,6 +3561,40 @@ printf "%s\n" "#define HAVE_PGRES_SINGLE_TUPLE 1" >>confdefs.h
                { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }
 
+else case e in #(
+  e)
+               { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+        ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PGRES_TUPLES_CHUNK" >&5
+printf %s "checking for PGRES_TUPLES_CHUNK... " >&6; }
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <libpq-fe.h>
+int
+main (void)
+{
+
+               if (PGRES_TUPLES_CHUNK) return 0;
+               return 1;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+
+
+printf "%s\n" "#define HAVE_PGRES_TUPLES_CHUNK 1" >>confdefs.h
+
+               { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+
 else case e in #(
   e)
                { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
index 639929d0bfa57b0af0bad9593f13c2b18cd3cfe1..5d528aae46b25ce42140f28d5bf25aa6112e56e9 100644 (file)
@@ -63,6 +63,20 @@ else
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([for PGRES_TUPLES_CHUNK])
+       AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([#include <libpq-fe.h>], [[
+               if (PGRES_TUPLES_CHUNK) return 0;
+               return 1;
+       ]])],
+       [
+               AC_DEFINE([HAVE_PGRES_TUPLES_CHUNK], [1], [Whether the PGRES_TUPLES_CHUNK constant is defined])
+               AC_MSG_RESULT(yes)
+       ],
+       [
+               AC_MSG_RESULT(no)
+       ])
+
        AC_MSG_CHECKING([for PGRES_COPY_BOTH])
        AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([#include <libpq-fe.h>], [[
index 8387bf93f7016e2c856f7038f06f421c0bbfcbaf..a268845590dcf21ba020d0587fdbfe7058aa8ea2 100644 (file)
@@ -167,6 +167,9 @@ static sql_rcode_t sql_classify_error(rlm_sql_postgresql_t *inst, ExecStatusType
                case PGRES_COMMAND_OK:
        #ifdef HAVE_PGRES_SINGLE_TUPLE
                case PGRES_SINGLE_TUPLE:
+       #endif
+       #ifdef HAVE_PGRES_TUPLES_CHUNK
+               case PGRES_TUPLES_CHUNK:
        #endif
                case PGRES_TUPLES_OK:
        #ifdef HAVE_PGRES_COPY_BOTH
@@ -466,6 +469,9 @@ static void sql_trunk_request_demux(UNUSED fr_event_list_t *el, UNUSED trunk_con
                 */
 #ifdef HAVE_PGRES_SINGLE_TUPLE
                case PGRES_SINGLE_TUPLE:
+#endif
+#ifdef HAVE_PGRES_TUPLES_CHUNK
+               case PGRES_TUPLES_CHUNK:
 #endif
                case PGRES_TUPLES_OK:
                        sql_conn->cur_row = 0;