From b1176cc4aeec1ed9cce88a0611a08d046d53d764 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Thu, 28 Mar 2024 17:40:49 -0400 Subject: [PATCH] squash. more code review updates --- .github/workflows/build-irods-centos.yml | 3 --- lib/api/include/irods/genquery2.h | 2 +- server/api/include/irods/rs_genquery2.hpp | 2 +- server/re/src/msi_genquery2.cpp | 22 +++++++++++++++------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-irods-centos.yml b/.github/workflows/build-irods-centos.yml index b9c5bea198..44cee9598b 100644 --- a/.github/workflows/build-irods-centos.yml +++ b/.github/workflows/build-irods-centos.yml @@ -18,10 +18,7 @@ jobs: yum -y install gcc g++ libstdc++-static make rpm-build bzip2-devel curl-devel fakeroot openssl-devel pam-devel python-devel unixODBC unixODBC-devel zlib-devel python36-distro - name: Install Flex and Bison run: | - #yum -y install centos-release-scl-rh rpm --import https://www.cert.org/forensics/repository/forensics-expires-2022-04-03.asc - #wget https://forensics.cert.org/cert-forensics-tools-release-el7.rpm - #rpm -i ./cert-forensics-tools-release-el7.rpm yum -y install https://forensics.cert.org/cert-forensics-tools-release-el7.rpm yum -y install flex bison - name: Install iRODS Externals diff --git a/lib/api/include/irods/genquery2.h b/lib/api/include/irods/genquery2.h index 19f915f424..2afd1934d9 100644 --- a/lib/api/include/irods/genquery2.h +++ b/lib/api/include/irods/genquery2.h @@ -104,7 +104,7 @@ extern "C" { /// } /// /// // At this point, "output" should represent a JSON string. -/// // Parse the string as JSON and inspect the results. +/// // Parse the string as JSON and inspect the results. /// // If "input.sql_only" was set to 1, "output" would hold the SQL derived from the GenQuery2 syntax. /// \endcode /// diff --git a/server/api/include/irods/rs_genquery2.hpp b/server/api/include/irods/rs_genquery2.hpp index 92d88988d7..5eb25833f6 100644 --- a/server/api/include/irods/rs_genquery2.hpp +++ b/server/api/include/irods/rs_genquery2.hpp @@ -68,7 +68,7 @@ struct RsComm; /// } /// /// // At this point, "output" should represent a JSON string. -/// // Parse the string as JSON and inspect the results. +/// // Parse the string as JSON and inspect the results. /// // If "input.sql_only" was set to 1, "output" would hold the SQL derived from the GenQuery2 syntax. /// \endcode /// diff --git a/server/re/src/msi_genquery2.cpp b/server/re/src/msi_genquery2.cpp index c223866ff3..876810a9a1 100644 --- a/server/re/src/msi_genquery2.cpp +++ b/server/re/src/msi_genquery2.cpp @@ -101,14 +101,14 @@ auto msi_genquery2_execute(MsParam* _handle, MsParam* _query_string, RuleExecInf /// \code{.py} /// # Execute a query. The results are stored in the Rule Engine Plugin. /// msi_genquery2_execute(*handle, "select COLL_NAME, DATA_NAME order by DATA_NAME desc limit 1"); -/// +/// /// # Iterate over the results. /// while (errorcode(genquery2_next_row(*handle)) == 0) { /// genquery2_column(*handle, '0', *coll_name); # Copy the COLL_NAME into *coll_name. /// genquery2_column(*handle, '1', *data_name); # Copy the DATA_NAME into *data_name. /// writeLine("stdout", "logical path => [*coll_name/*data_name]"); /// } -/// +/// /// # Free any resources used. This is handled for you when the agent is shut down as well. /// genquery2_free(*handle); /// \endcode @@ -130,7 +130,8 @@ auto msi_genquery2_next_row(MsParam* _handle, RuleExecInfo* _rei) -> int try { const auto ctx_handle_index = std::stoll(static_cast(_handle->inOutStruct)); - if (ctx_handle_index < 0 || static_cast(ctx_handle_index) >= gq2_context.size()) { + if (ctx_handle_index < 0 || + static_cast(ctx_handle_index) >= gq2_context.size()) { log_msi::error("{}: Unknown context handle.", __func__); return SYS_INVALID_INPUT_PARAM; } @@ -139,11 +140,18 @@ auto msi_genquery2_next_row(MsParam* _handle, RuleExecInfo* _rei) -> int if (ctx.current_row < static_cast(ctx.rows.size()) - 1) { ++ctx.current_row; - log_msi::trace("{}: Incremented row position [{} => {}]. Returning 0.", __func__, ctx.current_row - 1, ctx.current_row); + log_msi::trace("{}: Incremented row position [{} => {}]. Returning 0.", + __func__, + ctx.current_row - 1, + ctx.current_row); return 0; } - log_msi::trace("{}: Skipping increment of row position [current_row=[{}]]. Returning 1.", __func__, ctx.current_row); + log_msi::trace( + "{}: Skipping increment of row position [current_row=[{}]]. Returning GENQUERY2_END_OF_RESULTSET ({}).", + __func__, + ctx.current_row, + GENQUERY2_END_OF_RESULTSET); return GENQUERY2_END_OF_RESULTSET; } @@ -195,7 +203,7 @@ auto msi_genquery2_column(MsParam* _handle, MsParam* _column_index, MsParam* _co const auto ctx_handle_index = std::stoll(static_cast(_handle->inOutStruct)); if (ctx_handle_index < 0 || - static_cast(ctx_handle_index) >= gq2_context.size()) { + static_cast(ctx_handle_index) >= gq2_context.size()) { log_msi::error("{}: Unknown context handle.", __func__); return SYS_INVALID_INPUT_PARAM; } @@ -253,7 +261,7 @@ auto msi_genquery2_free(MsParam* _handle, RuleExecInfo* _rei) -> int const auto ctx_handle_index = std::stoll(static_cast(_handle->inOutStruct)); if (ctx_handle_index < 0 || - static_cast(ctx_handle_index) >= gq2_context.size()) { + static_cast(ctx_handle_index) >= gq2_context.size()) { log_msi::error("{}: Unknown context handle.", __func__); return SYS_INVALID_INPUT_PARAM; }