Skip to content

Commit

Permalink
squash. more code review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Mar 28, 2024
1 parent 8612635 commit b1176cc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-irods-centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/api/include/irods/genquery2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
2 changes: 1 addition & 1 deletion server/api/include/irods/rs_genquery2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
22 changes: 15 additions & 7 deletions server/re/src/msi_genquery2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -130,7 +130,8 @@ auto msi_genquery2_next_row(MsParam* _handle, RuleExecInfo* _rei) -> int
try {
const auto ctx_handle_index = std::stoll(static_cast<char*>(_handle->inOutStruct));

if (ctx_handle_index < 0 || static_cast<decltype(gq2_context)::size_type>(ctx_handle_index) >= gq2_context.size()) {
if (ctx_handle_index < 0 ||
static_cast<decltype(gq2_context)::size_type>(ctx_handle_index) >= gq2_context.size()) {
log_msi::error("{}: Unknown context handle.", __func__);
return SYS_INVALID_INPUT_PARAM;
}
Expand All @@ -139,11 +140,18 @@ auto msi_genquery2_next_row(MsParam* _handle, RuleExecInfo* _rei) -> int

if (ctx.current_row < static_cast<std::int32_t>(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;
}
Expand Down Expand Up @@ -195,7 +203,7 @@ auto msi_genquery2_column(MsParam* _handle, MsParam* _column_index, MsParam* _co
const auto ctx_handle_index = std::stoll(static_cast<char*>(_handle->inOutStruct));

if (ctx_handle_index < 0 ||
static_cast<decltype(gq2_context)::size_type>(ctx_handle_index) >= gq2_context.size()) {
static_cast<decltype(gq2_context)::size_type>(ctx_handle_index) >= gq2_context.size()) {
log_msi::error("{}: Unknown context handle.", __func__);
return SYS_INVALID_INPUT_PARAM;
}
Expand Down Expand Up @@ -253,7 +261,7 @@ auto msi_genquery2_free(MsParam* _handle, RuleExecInfo* _rei) -> int
const auto ctx_handle_index = std::stoll(static_cast<char*>(_handle->inOutStruct));

if (ctx_handle_index < 0 ||
static_cast<decltype(gq2_context)::size_type>(ctx_handle_index) >= gq2_context.size()) {
static_cast<decltype(gq2_context)::size_type>(ctx_handle_index) >= gq2_context.size()) {
log_msi::error("{}: Unknown context handle.", __func__);
return SYS_INVALID_INPUT_PARAM;
}
Expand Down

0 comments on commit b1176cc

Please sign in to comment.