xpxExecuteQueryBNEX
FUNCTION xpxExecuteQueryBNEx(modelId : GENERIC; modelVersion : INTEGER; querySchemaName, queryName : STRING; options : INTEGER; columnNames : STRING; orderBy : STRING; xmlConfigurationName : STRING; encodingEDM, encodingXML : STRING; resultFileName : STRING; arguments : INTEGER; VAR queryResultIndex : INTEGER; VAR queryResult : GENERIC; VAR resultString : STRING; argument1, ..., argumentN : GENERIC) status : INTEGER;
The xpxExecuteQueryBN function invokes the specified EDMquery with the specified arguments on the specified data model. An EDMquery is defined in an EDMquerySchema. An EDMquerySchema is defined in an EDMdatabase by the xpxDefineQuerySchema operation. The execution of an EDMquery is fully performed by the EDMexpressVM. The result of the EDMquery is returned to the caller. The data required to hold the result data is allocated by the xpxExecuteQuery operation. The operation xpxFreeQueryResult should be invoked by the calling application to free the result data when it is no longer needed. The actual data model must be open before this operation can be successfully performed. If the query is supposed to update the model, the model must be open for read and write access. See xpxOpenModel or xpxOpenModelBN for details. 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.
It is strongly advised to use the following functions for nested query levels
Arguments
Type | Name | Comment |
GENERIC | modelId | A numeric modelID that uniquely identifies the data model in the EDMdatabase to run the specified EDMquery on |
STRING | querySchemaName | Specifies the name of the EDMquerySchema that defines the EDMquery of interest. This query schema must exist in the EDMdatabase. Query schema names are case insensitive. |
STRING | queryName | Specifies the name of an EDMquery function that should be invoked. EDMquery names are case insensitive. |
INTEGER | arguments | Number of arguments supplied to the actual EDMquery function. This number should correspond to signature of the actual EDMquery function, i.e., the <arguments> should correspond to the number of formal parameters in the actual EDMquery function declaration in the EDMquerySchema. maximum number of arguments is 64 |
INTEGER | options | see below |
GENERIC | queryResultIdex | Â |
GENERIC | queryResult | Address of a variable that will receive the result of the operation. The received result will be of data type SdaiQueryResult. |
GENERIC | argument(N) | Â |
1 | Type | Name: | Comment |
2 | GENERIC | modelId | A numeric modelID that uniquely identifies the data model in the EDMdatabase to run the specified EDMquery on. The modelID is returned when the model is created or it can be retrieved by the following operations: xpxGetModel, xpxGetModelBN or xpxGetInstanceModel. |
3 | INTEGER | modelVersion | Â |
4 | STRING | querySchemaName | Specifies the name of the EDMquerySchema that defines the EDMquery of interest. This query schema must exist in the EDMdatabase. Query schema names are case insensitive |
5 | STRING | queryName | Specifies the name of an EDMquery function that should be invoked. EDMquery names are case insensitive. |
6 | INTEGER | options | Specifies the current EDMexpressCompiler options. The <options> value should be specified as a bitwise OR of the options to enable. See the edmiExpressToHTML function for details of available options. All option names are defined in the header file sdai.h |
7 | STRING | columnNames | Â |
8 | STRING | orderBy | Â |
9 | STRING | xmlConfigurationName | The name of the XML Configuration to apply to the resulting XML output. |
10 | STRING | encodingEDM | The encoding of data in EDM (source). Default is UTF8. Legal values are; |
11 | STRING | encodingXML | The desired character encoding for the resulting XML string. Default is UTF8. Legal values are; |
12 | STRING | resultFileName | Â |
13 | INTEGER | arguments | Number of arguments supplied to the actual EDMquery function.This number should correspond to signature of the actual EDMquery function, i.e., the <arguments> should correspond to the number of formal parameters in the actual EDMquery function declaration in the EDMquerySchema. |
14 | INTEGER | queryResultIndex | Â |
15 | GENERIC | queryResult | Â |
16 | STRING | 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. |
17 | GENERIC | argument(N) | Â |
Return Value
Options
 | Option | Comment |
---|---|---|
1 | XPXALL_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 | XPXINCLUDE_CONFIGURATION | Include configuration element when writing ISO_10303_28 document |
3 | XPXINCLUDE_SCHEMA | Include schema elements when writing ISO_10303_28 document |
4 | XPXRESULT_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 | XPXOPEN_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 | XPXEXTRACT_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 | XPXASCENDING | Arrange the query result in ascending order. This option is only applicable when the <orderBy> argument is used. |
8 | XPXDESCENDING | Arrange the query result in descending order. This option is only applicable when the <orderBy> argument is used. |
9 | XPXRESULT_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 | XPXRESULT_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 | XPXRESULT_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 | XPXEDM_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 | XPXRESULT_AS_TABLE | Specifies that the result of the 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 | XPXHTML_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 | XPXASCII_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 | XPXOLD_XML_FORMAT | The result of the query will be returned in a simple well formed XML formatted file on the local file system. |
17 | XPXXML_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 | XPXZIPPED_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 | XPXIGNORE_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
<Missing Example>
Â
See also
Filter by label
There are no items with the selected labels at this time.
 Â