edmiExecuteQueryBNEx
Â
EdmiError edmiExecuteQueryBNEx (SdaiModel modelId, SdaiString querySchemaName, SdaiString queryName, SdaiInteger numberOfParameters, SdaiSelect parameters[], SdaiInteger options, SdaiQueryResult *queryResult, SdaiString xmlConfigurationName, SdaiString *resultString, SdaiString resultFileFileName, SdaiString edmEncoding, SdaiString xmlEncoding, SdaiSelect extensionsArgs);
Invokes an EDMquery function with a number of arguments on a given edmModel. An EDMquery is defined in an EDMquerySchema. An EDMquerySchema is defined in an EDMdatabase by the edmiDefineQuerySchema operation. The execution of an EDMquery is performed by the EDMexpressVM. The result of the EDMquery will be returned to the caller. The system memory required to hold the result data will implicitly be allocated by the edmiExecuteQuery function. Use edmiFreeQueryResult to release the allocated memory when it is no longer needed. The result of this operation will be returned as a struct named SdaiQueryResult. See the include file sdai.h for detailed description of this struct The actual edmModel must be open before this operation can be successfully performed. If the query is supposed to update the model population, the model must be opened for read and write access. See sdaiOpenModel or sdaiOpenModelBN for details. Powerful trace mechanisms are available for testing and debugging through the "expressions logging", see: edmiDefineExpressionsLog It is recommended to use the EDMsupervisor and the interactive EDMdebugger to test and debug all Express and Express-X schemata executed by the EDMexpressVM, including EDMquery. This function also offers the feature to generate XML-formatted query results.
Â
Arguments
1 | Type | Name | Comment |
2 | SdaiModel | modelId | The modelID that uniquely identifies the edmModel in which to run the specified EDMquery. |
3 | SdaiString | querySchemaName | The name of the EDMquerySchema in which the EDMquery is defined. The query schema must exist in the EDMdatabase. Query schema names are case insensitive. |
4 | SdaiString | queryName | The name of the EDMquery function to be invoked. EDMquery names are case insensitive. |
5 | SdaiInteger | arguments | The number of arguments supplied to the EDMquery function. This number must match to the number of formal parameters in the actual EDMquery function declaration in the EDMquerySchema. |
6 | SdaiSelect | arguments[] | Buffer of select structures containing all the arguments to pass over to the query function. |
7 | SdaiInteger | options | See detailed descriptions of the available options below. The option value must be a bitwise OR between the the desired options. |
8 | SdaiQueryResult | queryResult | Variable that will receive the result of the query. |
9 | SdaiString | xmlConfigurationName | The name of the XML Configuration to apply to the resulting XML output. |
10 | SdaiString | resultString | Variable that will receive a pointer to an allocated string buffer containing the XML outut from the query. This parameter is only applicable when the option [RESULT_IN_XML_STRING] is set. |
11 | SdaiString | resultFileFileName | The name of the file that will receive the XML outut from the query. |
12 | SdaiString | edmEncoding | The encoding of data in EDM (source). Default is UTF8. Legal values are; |
13 | SdaiString | xmlEncoding | The desired character encoding for the resulting XML string. Default is UTF8. Legal values are; |
14 | SdaiSelect | extensionsArgs | For future use. Must be NULL. |
Return Value
Options
Â
 | Option | Comment |
---|---|---|
1 | ALL_ATTRIBUTES | When the argument <attributes> is NULL or an empty string, all attributes of the instances will be included in the query result. However, if the <attributes> argument is used to add one or more aditional constructed columns or to rename a column in the query result, the return of all the instance attributes will be hindered due to an <attributes> argument that is no longer NULL or an empty string. Use this option to force the including of all instance attributes even when the <attributes> argument is not NULL or an empty string. This option is only applicable on aggregates of instances. |
2 | INCLUDE_CONFIGURATION | Include configuration element when writing ISO_10303_28 document |
3 | INCLUDE_SCHEMA | Include schema elements when writing ISO_10303_28 document |
4 | RESULT_IN_STRING | The resulting table will be returned in a string allocated in heap-memory of the calling application. Use edmiFree to release allocated memory. Use the option [RESULT_IN_XML_FILE] to write the table to a file. |
5 | OPEN_MODEL_FOR_WRITE_ACCESS | Use this option if the query function contains statements that will or might create or update the population within the source model. |
6 | EXTRACT_SHALLOW | Use this option to force a shallow XML formatted query result. ISO10303-28 compliant XML Query results are deep by default. No other query result format supported by this function is deep. Hence, this option has no effect unless combined with the option [XML_FORMAT]. |
7 | ASCENDING | Arrange the query result in ascending order. This option is only applicable when the <orderBy> argument is used. |
8 | DESCENDING | Arrange the query result in descending order. This option is only applicable when the <orderBy> argument is used. |
9 | RESULT_AS_ID | When the declared return value of a query function is of type sdaiAGGR, the output will be returned as a scratch aggregate Id in the attribute data.value.aggrVal of the returned SdaiQueryResult struct. |
10 | RESULT_AS_ID_CONTENTS | When the declared return value of a query function is of type sdaiAGGR, the output will be returned as a table with one column and n rows, where n is the number of elements in the returned aggregate. |
11 | RESULT_IN_XML_FILE | The output from the query function will be converted to XML code and written to the file specified in the parameter <resultFileFileName> |
12 | EDM_IDENTIFIERS | Use the full internal instanceIds of EDM as step Ids in the exported XML file. By default, the step Ids are the local references from within each model. |
13 | RESULT_AS_TABLE | Specifies that the result of the edmiExecuteQueryExBN operation should be returned as a table. This option is only valid when the EDMquery result is an aggregate of instances or an aggregate of view instances. The number of elements in the aggregate will be the number of rows in the table and the number of attributes in the actual instance type or view type will be the number of columns in the table. |
14 | HTML_FORMAT | The query result table will be presented in HTML format in a locally allocated string or in a file on the local file system. See the options [RESULT_IN_XML_FILE] and [RESULT_IN_STRING]. |
15 | ASCII_FORMAT | The query result table will be presented in plain ASCII format in a locally allocated string or in a file on the local file system. See the options [RESULT_IN_XML_FILE] and [RESULT_IN_STRING]. |
16 | OLD_XML_FORMAT | The result of the query will be returned in a simple well formed XML formatted file on the local file system. |
17 | XML_FORMAT | The result of the query will be returned in an ISO10303-28 compliant XML formatted string or in a file on the local file system. |
18 | ZIPPED_FILE | The file given by the argument <resultFileName> will be compressed . This option has no effect unless combined with the option [RESULT_IN_XML_FILE]. |
19 | IGNORE_EMPTY_COLUMNS | Columns for attributes that do not have defined values for any of the returned instances will be left out of the query result table. |
Example
Â
 EdmiError rstat; SdaiString resultString; SdaiQueryResult queryResult; SdaiModel modId; SdaiInteger option; tSdaiSelect par1, par2; SdaiSelect par[2] = {&par1, &par2}; /* Prepare the parameter buffer */ par[0]>nTypes = par[1]>nTypes = 0; par[0]>typeList = par[1]>typeList = NULL; par[0]->type = sdaiSTRING; par[1]->type = sdaiINTEGER; par[0]->value.stringVal = (char*) malloc(strlen("Johnny")+1); strcpy(par[0]->value.stringVal, "Johnny"); par[1]->value.intVal = 36; option = RESULT_IN_XML_STRING; option |= OPEN_MODEL_FOR_WRITE_ACCESS; /* Execute the query function */ if (rstat = edmiExecuteQueryBNEx(modId, "FriendQuerySchema", "UpdateFriend", 2, par, option, &queryResult, "MyXmlConfiguration", &resultString, NULL, "UTF-8", "UTF-8", NULL)) { printf("\nError %d in edmiExecuteQueryBNEx: %s", rstat, edmiGetErrorText(rstat)); goto err; } printf("\nResulting XML:"); printf("\n%s", resultString); edmiFree(resultString); . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â
Â