我怎么知道 IIB 中的 LASTMOVE 什么时候 return 是真还是假?
How can I know when LASTMOVE in IIB will return true or 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在本例return中哪个场景为真,哪个场景为假。谢谢大家
我使用 LASTMOVE 的经验是它可以 return NULL
,所以最好只检查 TRUE
:
DECLARE CfgDataRef REFERENCE TO S_ConfigSharedRow.CfgDataCache;
IF LASTMOVE(CfgDataRef) THEN
-- Nothing to do
ELSE
-- Select all the relevant content ...
END IF;
-- 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在本例return中哪个场景为真,哪个场景为假。谢谢大家
我使用 LASTMOVE 的经验是它可以 return NULL
,所以最好只检查 TRUE
:
DECLARE CfgDataRef REFERENCE TO S_ConfigSharedRow.CfgDataCache;
IF LASTMOVE(CfgDataRef) THEN
-- Nothing to do
ELSE
-- Select all the relevant content ...
END IF;