edmiModifyMethodSignature
EdmiError edmiModifyMethodSignature(SdaiInstance methodId, SdaiString methodClass, SdaiPrimitiveType returnValueDatatype, SdaiInstance returnValueDomainId, SdaiString parameterNames[], SdaiPrimitiveType parameterDatatype[], SdaiInstance parameterDomainIds[], SdaiString description);
Changes additional information / documentation of a method in the EDMdatabase. The purpose of the user defined method signatures is to provide information about the methods and their input parameters to the users. The methods in question are Express-X mapping schemas and query functions. This is the only way to add classification and description to a query function method. For Express-X schema maps, this information may also be given by edmiDefineMethodSignature.
Arguments
Type | Name | Comment |
SdaiInstance | methodId | The instance Id of the method to modify. This Id is an instance of the EDM_METHOD entity in the ExpressDataManager model. |
SdaiString | methodClass | The type of method. Values are:
|
SdaiPrimitiveType | returnValueDatatype | Â |
SdaiInstance | returnValueDomainId | Â |
SdaiString | parameterNames | A NULL terminated list of parameter names. Not applicable for query function methods. |
SdaiPrimitiveType | parameterDatatype | A list of parameter data types that corresponds to the <parameterNames>. Not applicable for query function methods. |
SdaiInstance | parameterDomainIds | Optional, zero terminated buffer of parameter domainIds |
SdaiString | description | Optional. A textual description of the method. |
Return Value
Options
Â
Example
Â
 EdmiError rstat; SdaiInteger nErr, nWrn; SdaiInstance xpxMethodId, qexMethodId; SdaiString parNamesXpx[4] = {"Name", "Sex", "Weight", NULL}; SdaiPrimitiveType parTypesXpx[3] = {sdaiSTRING, sdaiINTEGER, sdaiREAL}; /* Define Schemas */ rstat = edmiDefineSchema("c:/data/person.exp", "c:/temp/person.dia", "Person", 0, &nWrn, &nErr); rstat = edmiDefineSchemaMap("c:/data/person_maps.xpx", "c:/temp/person_maps.dia", 0, &nWrn, &nErr); rstat = edmiDefineQuerySchema("c:/data/person_queries.qex", "c:/data/person_queries.dia", 0, &nWrn, &nErr); /* Define Method Signatures */ /* Only applicable for "XPX" */ rstat = edmiDefineMethodSignature( "XPX", "Insert a Person", "InsertPerson", "CLASS_INPUT", parNamesXpx, parTypesXpx, "Inserts a new person"); /* Get Signature Ids */ rstat = edmiGetMethodSignatureId("XPX", "Insert a Person", "InsertPerson", &xpxMethodId); rstat = edmiGetMethodSignatureId("QEX", "SexHeavierThan", "Person.Queries", &qexMethodId); /* Modify Signatures */ if (qexMethodId) { SdaiString type, name, schema, class, desc, *argNames; SdaiPrimitiveType returnType, *argTypes; SdaiInteger nArg; rstat = edmiGetMethodSignature(qexMethodId, &type, &name, &schema, &class, &nArg, &returnType, &argNames, &argTypes, &desc); rstat = edmiModifyMethodSignature(qexMethodId, "CLASS_OUTPUT", NULL, NULL, "Returns all persons of a \ given sex exceeding a given \ threshold weight"); } . . . Express Schema - -------------------------------------------------------------- - File : c:/data/person.exp - -------------------------------------------------------------- SCHEMA person; ENTITY aperson; name : STRING; sex : STRING; weight : REAL; END_ENTITY; END_SCHEMA; Express-X Schema - -------------------------------------------------------------- - File : c:/data/person_maps.xpx - -------------------------------------------------------------- SCHEMA_MAP InsertPerson; GLOBAL DECLARE src INSTANCE OF SOURCE_SCHEMA person; DECLARE tar INSTANCE OF TARGET_SCHEMA person; END_GLOBAL; STATEMENTS; LOCAL npar : INTEGER; fail : BOOLEAN := FALSE; name : STRING; sex : INTEGER; weight : REAL; parType : INTEGER; END_LOCAL; IF (xpxGetNumberOfUserParameters() = 3) THEN xpxGetUserParameter(1, name); xpxGetUserParameter(2, sex); xpxGetUserParameter(3, weight); xpxCreateInstanceAndPutAttrsBN(XPXTARGETMODELID, "aperson", 3, xpxSTRING, name, xpxINTEGER, sex, xpxREAL, weight); } END_STATEMENTS; END_SCHEMA_MAP; Query Schema. - -------------------------------------------------------------- - File : c:/data/person_queries.qex - -------------------------------------------------------------- QUERY_SCHEMA queries FOR person; GLOBAL DECLARE src INSTANCE OF person; END_GLOBAL; VIEW_ENTITY PersonView; name : STRING; sex : INTEGER; weight : REAL; END_VIEW_ENTITY; QUERY_FUNCTION SexHeavierThan ( p_sex:INTEGER; p_weight:REAL) : SET OF PersonView; LOCAL result : SET of PersonView; currView : PersonView; END_LOCAL; FROM(s:src::aperson) WHEN TRUE; BEGIN IF((s.sex = p_sex) AND (s.weight > p_weight)) THEN NEW currView; currView.name := s.name; currView.sex := s.sex; currView.weight := s.weight; result ++ currView; END_IF; END; RETURN(result); END_QUERY_FUNCTION; END_QUERY_SCHEMA;
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â