ibm-mq - 我如何知道 IIB 中的 LASTMOVE 何时返回 true 或 false?
问题描述
-- Shared row variable for caching config data. Declared at Global scope.
DECLARE S_ConfigSharedRow SHARED ROW;
CREATE COMPUTE MODULE TheFirstComputeNode
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CFGDATA_CACHE_LOCK: BEGIN ATOMIC
-- If the configuration data is not available in the cache then load it from the CONFIG table
DECLARE CfgDataRef REFERENCE TO S_ConfigSharedRow.CfgDataCache;
IF NOT LASTMOVE(CfgDataRef) THEN
-- Select all the relevant content from the actual database in one go.
DECLARE DBResults ROW;
DECLARE RetryCount INTEGER 5;
SET DBResults.Row[] = PASSTHRU('SELECT * FROM CONFIG');
-- Typically you would post process the content from the DB into a more amenable
-- structure but the following will get the data into the shared variable
CREATE LASTCHILD OF S_ConfigSharedRow.CfgDataCache FROM DBResults;
END IF;
END CFGDATA_CACHE_LOCK;
-- Config data is now available for use
RETURN TRUE;
END;
END MODULE;
大家好,请问LASTMOVE在这种情况下返回true的情况是什么,哪种情况是false。谢谢大家。
解决方案
我对LASTMOVE的经验是它可以返回NULL
,所以最好只检查TRUE
:
DECLARE CfgDataRef REFERENCE TO S_ConfigSharedRow.CfgDataCache;
IF LASTMOVE(CfgDataRef) THEN
-- Nothing to do
ELSE
-- Select all the relevant content ...
END IF;
推荐阅读
- r - R中的内存分析:如何找到最大内存使用的位置?
- python - 在不知道聚类数量的情况下根据起点和终点对线进行聚类
- java - Spring Boot项目上的Hibernate SessionFactory注入不起作用
- c# - 如何将 Double 存储在 Type 变量中?
- python - Numpy,将数据帧乘以输出 NaN 的数字
- recommendation-engine - 在 CF item-item 推荐器中,当矩阵稀疏时如何计算项目相似度?
- java - 如何使用最终 int 设置字符串数组的大小?
- java - Map 中的 Java 流
- javascript - 未捕获的 DOMException:无法在我的 html 页面上运行 codepen 代码
- scikit-learn - 带有 scikit-learn 的英特尔 daal4py 分类器