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 Current »


 
Returns a querySchemaId that uniquely identifies an EDMquerySchema in the remote EDMdatabase.
Related functions: edmiRemoteGetQuery, edmiRemoteExecuteQuery, edmiRemoteExecuteQueryEx,
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteGetQuerySchema(SdaiServerContext serverContextId,
                                    SdaiString        schemaName,
                                    SdaiString        querySchemaName,
                                    SdaiQuerySchema   *querySchemaId,
                                    SdaiInvocationId  *edmiInvocationId);
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

schemaName

The name of the Express Schema for which the Query Schema has been compiled. This Express Schema must be compiled to form a dictionary model in the _EDMdatabase{_}. Express Schema names are case insensitive and unique within the scope of an _EDMdatabase_ .

querySchemaName

The name of the Query Schema for which to retrieve its unique querySchemaId. Query Schema names are case insensitive and unique within the scope of an Express Schema.

querySchemaId

A variable that will receive the numeric querySchemaID that uniquely identifies the Query Schema instance in the remote _EDMdatabase_ .

edmiInvocationId

Currently not used.

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
/*
– -------------------------------------- 
– File: c:/data/furniture.exp 
– -------------------------------------- 
SCHEMA Furniture 
TYPE tScrewType = ENUMERATION OF (PHILIPS, ALLEN, FLAT); END_TYPE; 
ENTITY Screw; 
Id : STRING; 
Typ : tScrewType; 
Len : REAL; 
Dia : REAL; 
END_ENTITY; 
ENTITY Dining_Table; 
Name : STRING; 
Legs : INTEGER; 
Len : REAL; 
Width : REAL; 
Height : REAL; 
Screws : BAG OF Screw; 
END_ENTITY; 
END_SCHEMA; 
 
– --------------------------------------- 
– File: c:/data/furniture_query.qex 
– --------------------------------------- 
QUERY_SCHEMA Furniture_Query FOR Furniture; 
GLOBAL 
DECLARE src INSTANCE OF Furniture;  
END_GLOBAL; 
 
VIEW_ENTITY View_Table; 
Name : STRING; 
Area : REAL; 
END_VIEW_ENTITY; 
 
QUERY_FUNCTION Dining_Table_Area (Area : REAL) : SET OF View_Table; 
LOCAL 
result : SET of View_Table; 
currView : View_Table; 
table_area : REAL; 
END_LOCAL; 
FROM(sdt:src::Dining_Table) 
WHEN TRUE; 
BEGIN 
table_area := sdt.Len*sdt.Width; 
IF(table_area > Area ) THEN 
NEW currView; 
currView.Name := sdt.Name; 
currView.Area := table_area; 
result ++ currView; 
END_IF; 
END; 
RETURN(result); 
END_QUERY_FUNCTION;  
END_QUERY_SCHEMA; 
*/
EdmiError rstat;
SdaiInteger nErr, nWrn;
SdaiServerContext myContext;
SdaiQuerySchema qexSchemaId;
SdaiQuery queryId;
 
/* Define Remote Server Context */
rstat = edmiDefineServerContext("MyRemoteServerContext",
"Johnny", "Supervisor", "cf37ftr", 
"TCP", "9090", "MyServerHost", 
NULL, NULL, NULL, NULL, NULL, &myContext); 
 
/* Compile the Express Schema */
rstat = edmiRemoteDefineSchema(myContext, EXPRESS_SCHEMA_TYPE,
"c:/data/furniture.exp", "c:/temp/furniture.dia",  
"Furniture", 0, &nWrn, &nErr, NULL); 
 
/* Compile the Query Schema */
rstat = edmiRemoteDefineSchema(myContext, QUERY_SCHEMA_TYPE,
"c:/data/furniture_query.qex", "c:/temp/furniture_query.dia", 
"Furniture_Query", 0, &nWrn, &nErr, NULL); 
 
/* Get the Query Schema Id */
rstat = edmiRemoteGetQuerySchema(myContext, "Furniture",
"Furniture_Query", &qexSchemaId, NULL); 
printf("\nQuery Schema Id = %d", qexSchemaId);
 
/* Get the Query Function Id */
rstat = edmiRemoteGetQuery(myContext, "Furniture",
"Furniture_Query", "Dining_Table_Area",  
&queryId, NULL); 
printf("\nQuery Function Id = %d", queryId);
. . .

  • No labels