Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

<xpfExecuteFunction family>

The XPX functions implemented to invoke functions and procedure located on other schemas than the caller, can be divided in two classes:

Functions called by a handle
============================
The handle must be retrieved by a function call and is valid as long as the actual schema (express/query/rule/map schema) defining the actual declaration (query schema/ query/function/procedure) is open. A handle is a “direct memory  address” to the actual declaration that avoids all “searching” when the actual declaration is accessed. Hence, a handle to a declaration in another (foreign) schema may be invalid due to the  foreign schema being updated (recompiled) after the actual handle being retrieved. Hence, it is “mandatory” to use exception handler to catch “invalid handle” and request new handler values for the invalid handlers. 
The advantage of using handlers is that the actual functions have a minimum of “extra parameters” (parameters not belonging to the actual called function)  and that the same handler can be used in all calls in a schema, to the same functions.
The “function call overhead” will increase with the number of “ Less parameters to a It is recommended that the handler name should be the same as the name of the related declaration to make the code more readable.
The disadvantage may be the requirement of having the exception handler for keeping all the handlers valid

Functions called by name
========================
Functions called by name have more “extra parameters” (mostly 1 or 2) than the same functions called by handle. The first time each call is invoked, all name references is resolved and a handle is retrieved such that all later the call is invoked, the handle is used such that no name reference resolving is required. 
The advantage of using “by name” invocations is that the implicitly used handle will always be valid as long as the actual declaration is not being deleted. Recompiling of the schema defining  the actual declaration will implicitly be handled.

</xpfExecuteFunction family>

 

Query function invocations: =========================== FUNCTION xpfGetQuerySchemaHandle (expressSchemaName
Code Block
Code Block
languagecpp
themeConfluence
FUNCTION xpfExecuteQuery (modelId      : STRING;                                    querySchemaName        : STRING)
                                   querySchemaHandle      : INTEGER;
                                          
 
FUNCTION xpfGetQueryHandle  (querySchemaHandle      : INTEGER;
                 : GENERIC;  -- optional argument
           queryName              : STRING)                              queryHandle            : INTEGER;   FUNCTION xpfGetQueryHandleBN  (expressSchemaName      : STRING;
                               querySchemaName        : STRING;
                               queryName              : STRING)
                               queryHandle            : INTEGER;
 
FUNCTION xpfExecuteQuery (queryHandle                 : INTEGER;
                          argument1, ..., argumentN   : GENERIC) -- arguments to actual called query
                          queryFunctionValue          : GENERIC;
                                         
 
FUNCTION xpfExecuteQueryEx (dataModelId                 : GENERIC;  -- optional. Default is callers actual data model
                            queryHandle                 : INTEGER; 
                            argument1, ..., argumentN   : GENERIC)  -- arguments to actual called query
                            queryFunctionValue          : GENERIC;
                                        
 
FUNCTION xpfExecuteQueryBN (expressSchemaName          : STRING;
                            querySchemaName            : STRING;
                            queryFunctionName          : STRING;
                            argument1, ..., argumentN  : GENERIC)  -- arguments to actual called query
                            queryFunctionValue         : GENERIC;  
 
FUNCTION xpfExecuteQueryEXBN (dataModelId                : GENERIC;  -- optional. Default is callers actual data model
                              expressSchemaName          : STRING;
                              querySchemaName            : STRING;
                              queryFunctionName          : STRING;
                              argument1, ..., argumentN  : GENERIC) -- arguments to actual called query
                              queryFunctionValue         : GENERIC; 
 




Related functions:
==================

FUNCTION xpxSetVmTargetModelBN (repositoryNameOrRepositoryId : GENERIC;
                                modelNameOrModelId           : GENERIC;
                                modelAccessMode              : INTEGER); -- LATER: xpxAddModelToActiveTransaction if xpxRW
 
FUNCTION xpxSetVmTargetModel (modelId          : GENERIC;
                              modelAccessMode  : INTEGER;  -- LATER: xpxAddModelToActiveTransaction if xpxRW
 

Include Page
US:_xpxExecute common
US:_xpxExecute common

The argument “modelId” is optional, i.e., it is not “necessary” for the calling function to set the actual target data model for the called function. The data model (xpxTargetModelId) can be set in the called function itself by invoking one of the following two functions:

  1. xpxSetVmTargetModel
  2. xpxSetVmTargetModelBN

Note: An exception (error) will be raised when one of these two above listed functions are called within an “open” FROM statement. The xpfExecuteQuery function has an argument called “queryHandle”. In general, the concept “handles” is introduced in EDMvm to boost performance. Until now, items like local variables, global variables, functions, etc., has been search for using linked lists, but using handles , the actual handle gives a direct “address” to the actual item. A handle is only valid within one EDMvm session. Simplified, a handle is similar to “an open file descriptor”, i.e., it must be retrieved in each session of a program,

The following functions are introduced for retrieving handles:

  1. xpfGetQuerySchemaHandle
  2. xpfGetFunctionHandleBN
  3. xpfGetFunctionHandle

The xpfGetFunctionHandleBN and the xpfGetFunctionHandle functions can be used to get the “function handle” to any function in a query schema, not only query functions.

Arguments

...

Insert excerpt
US:_a_queryHandle
US:_a_queryHandle
nopaneltrue
Insert excerpt
US:_a_Arguments
US:_a_Arguments
nopaneltrue
Insert excerpt
US:_a_modelId_XPX
US:_a_modelId_XPX
nopaneltrue

Return Value

...

 

Insert excerpt
US:_r_queryFunctionValue
US:_r_queryFunctionValue
nopaneltrue

Options

...

 

 

Example

...

<example missing>

 

See also

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "execute_function" and parent = "5636522"
Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "VM_functions" and parent = "5636522"