...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiGetQueryResultColumnsBN (SdaiQueryResult queryResult,
SdaiInteger rowNumber,
SdaiInteger numberColumns,
/* [SdaiString columnName,
SdaiPrimitiveType valueType,
void *value] */
...);
|
Reads an arbitrary number data elements contained in a single row of a table-formatted query result. The data elements must be identified by their common row number and their individual column names.
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, edmiGetQueryResultColumnBN.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiGetQueryResultColumnsBN (SdaiQueryResult queryResult,
SdaiInteger rowNumber,
SdaiInteger numberColumns,
/* [SdaiString columnName,
SdaiPrimitiveType valueType,
void *value] */
...);
Arguments:
Arguments
...
Type | Name | Comment | |
SdaiQueryResult | queryResult | 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. | |
SdaiInteger | 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. | |
SdaiInteger | numberColumns | The number of columns to read from the row identified by <rowNumber>. | |
SdaiString | columnName | The name of a column for which to read a value. | |
SdaiPrimitiveType | valueType | The primitive type of the data element to be read. | See section SDAI Data Types
|
void | value | Variable that will receive the value identified by its <rowNumber> and <columnName>. |
...
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Example
...
Code Block | ||
---|---|---|
| ||
EdmiError rstat; int i; SdaiString name, phoneNo, prof; SdaiInteger age; SdaiQueryResult queryResult; SdaiModel modId; . . . /* Execute the query function */ rstat = edmiExecuteQueryBN(modId, "FriendQuerySchema", "GetFriendBySexAndName", 2, RESULT_AS_TABLE, &queryResult, |
...
sdaiSTRING, "*", |
...
sdaiENUMERATION, "MALE"); |
...
printf("My male friends are:"); |
...
for (i=0;i<queryResult->rows;i++) { |
...
if (rstat = edmiGetQueryResultColumnsBN(queryResult, i, 4, |
...
"NAME", sdaiSTRING, &name, |
...
"AGE", sdaiINTEGER, &age, |
...
"PHONE NUMBER", sdaiSTRING, &phoneNo, |
...
"POFESSION", sdaiSTRING, &prof)) { |
...
printf("\nError %d in edmiGetQueryResultColumnsBN: %s", rstat, |
...
edmiGetErrorText(rstat)); |
...
goto err; |
...
} printf("\n%s (%d), %s, <%s>", name, age, phoneNo, prof); |
...
} edmiFreeQueryResult(queryResult); |
...
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|