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 »


 
Reads a single data element contained in a table-formatted query result. The data element must be identified by its row number and its column name.
This function is only applicable on the results from query functions that are invoked with the option RESULT_AS_TABLE.
Related functions: edmiExecuteQueryBN, edmiExecuteQueryBNEx, edmiFreeQueryResult, edmiGetQueryResultColumnsBN.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiGetQueryResultColumnBN (SdaiQueryResult  qResult,
                                       SdaiInteger      rowNumber, 
                                       /* [SdaiString columnName, 
                                       SdaiPrimitiveType valueType, 
                                        void *value] */ 
                                          ...);
Arguments:

qResult

The returned result of a query function. This parameter must be the result of a query that was called with the option [RESULT_AS_TABLE]. See edmiExecuteQueryBN.

rowNumber

The row number to read in the query result table. The number of rows in the table is stored in the rows element of the <qResult> data structure.

columnName

The name of the column for which to read a value.

valueType

The primitive type of the data element to be read. See section SDAI Data Types

value

Variable that will receive the value identified by its <rowNumber> and <columnName>.

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:
EdmiError rstat;
int i;
SdaiString name;
SdaiQueryResult queryResult;
SdaiModel modId;
/* Execute the query function */
rstat = edmiExecuteQueryBN(modId, "FriendQuerySchema",
"GetFriendsBySexAndName",  
2, RESULT_AS_TABLE, &queryResult,  
sdaiSTRING, "*", 
sdaiENUMERATION, "MALE"); 
printf("My male friends are:");
for (i=0;i<queryResult->rows;i++) {
if (rstat = edmiGetQueryResultColumnBN(queryResult, i, 
"NAME", sdaiSTRING, &name )) { 
printf("\nError %d in edmiGetQueryResultColumnBN: %s", rstat, 
edmiGetErrorText(rstat)); 
goto err; 

printf("\n%s", name); 

edmiFreeQueryResult(queryResult);
. . .

  • No labels