Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

xpfExecuteFunction family

 

xpfExecuteFunction
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.

Query function invocations:
===========================

FUNCTION xpfGetQuerySchemaHandle  (expressSchemaName      : STRING;
                                   querySchemaName        : STRING)
                                   querySchemaHandle      : INTEGER;
                                          
 
FUNCTION xpfGetQueryHandle  (querySchemaHandle      : INTEGER;
                             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; 
 

The following functions is valid for queries, functions and procedures
======================================================================
 
FUNCTION xpfGetFunctionHandleBN  (expressSchemaName      : STRING;
                                  querySchemaName        : STRING;  -- optional. Default is that all query schemas for "expressSchemaName" will be searched
                                  functionName           : STRING)  -- query, function or procedure
                                  functionHandle         : INTEGER; -- handle to actual query, function or procedure
                                        
 
FUNCTION xpfGetFunctionHandle  (querySchemaHandle        : INTEGER;
                                functionName             : STRING)  -- query, function or procedure
                                functionHandle           : INTEGER; -- handle to actual query, function or procedure
 
FUNCTION xpfExecuteFunction (functionHandle               : INTEGER; -- handle to actual query, function or procedure
                             argument1, ..., argumentN    : GENERIC) -- arguments to actual called query, function or procedure
                             functionValue                : GENERIC; -- always INDETERMINATE for procedures
 
FUNCTION xpfExecuteFunctionEX (functionHandle               : INTEGER; -- handle to actual query, function or procedure
                               globalVariablesHandle        : INTEGER; -- optional. Default is current global variables
                               dataModelId                  : GENERIC; -- optional. Default is current data model
                               dataModelAcessMode           : INTEGER; -- optional. Default is xpxRO. LATER: xpxAddModelToActiveTransaction if xpxRW
                               argument1, ..., argumentN    : GENERIC) -- arguments to actual called query, function or procedure
                               functionValue                : GENERIC; -- always INDETERMINATE for procedures
                                                     
 
FUNCTION xpfExecuteFunctionBN (expressSchemaName            : STRING;
                               querySchemaName              : STRING;  -- optional. Default is that all query schemas for "expressSchemaName" will be searched
                               functionName                 : STRING;  -- query, function or procedure
                               argument1, ..., argument     : GENERIC) -- arguments to actual called query, function or procedure
                               functionValue                : GENERIC; -- always INDETERMINATE for procedures
 
FUNCTION xpfExecuteFunctionEXBN (expressSchemaName            : STRING;",
                                 querySchemaName              : STRING;  -- optional. Default is that all query schemas for "expressSchemaName" will be searched
                                 functionName                 : STRING;  -- query, function or procedure
                                 globalVariablesHandle        : INTEGER; -- optional. Default is current global variables
                                 dataModelId                  : GENERIC; -- optional. Default is current data model
                                 dataModelAcessMode           : INTEGER; -- optional. Default is xpxRO. LATER: xpxAddModelToActiveTransaction if xpxRW
                                 argument1, ..., argument     : GENERIC) -- arguments to actual called query, function or procedure
                                 functionValue                : GENERIC; -- always INDETERMINATE for procedures
                                       


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

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