sdaiCreateIterator
Creates a new iterator and connects the created iterator to the specified aggregate.
An iterator is an element position pointer in an aggregate. An iterator can be connected to all types of aggregates. The aggregate element pointed to by the iterator is called the current element of the iterator. Initially the created iterator is positioned at the beginning of the aggregate, i.e. before the first element in the aggregate. Hence, there is no current element of the actual iterator. The first subsequent sdaiNext operation will position the iterator to the first element in the connected aggregate.
A numeric iteratorID that uniquely identifies the created iterator in the actual _EDMserver_ session is returned. This iteratorID should be used in subsequent EDMinterface operations to identify the actual iterator within the same _EDMserver_ session. All iterators created within an open _EDMserver_ session will be deleted when the actual _EDMserver_ session is closed and the actual iterator has not been deleted by the sdaiDeleteIterator function.
An iteratorID is local to the application that creates the iterator.
Related functions: sdaiDeleteIterator , sdaiBeginning , sdaiNext , sdaiPrevious , sdaiEnd , sdaiGetAggrByIterator , sdaiPutAggrByIterator , sdaiUnsetAggrByIterator , edmiTestAggrByIterator , sdaiCreateNestedAggrByIterator , sdaiInsertBefore sdaiInsertAfter , sdaiRemove , sdaiDelete .
Header:
#include "sdai.h"
Prototype:
SdaiIterator sdaiCreateIterator(SdaiAggr aggregate);
Arguments:
aggregate |
A numeric aggregateID that uniquely identifies the aggregate instance in the EDMdatabase that will be connected to the created iterator. |
Returns:
A numeric iteratorID that uniquely identifies the new created iterator in the actual open _EDMserver_ session. This iteratorID should be used to identify the particular iterator in subsequent EDMinterface operations within the same open _EDMserver_ session.
iteratorID != 0 : operation successfully performed.
iteratorID = 0 : operation failed, use sdaiErrorQuery function to get error reason.
Example:
SdaiIterator iterId;
SdaiAggr aggregate;
...
iterId = sdaiCreateIterator(aggregate);
if (! iterId) {
/* Error in operation */
printf("\nError: %s in sdaiCreateIterator \n",
edmiGetErrorText(sdaiErrorQuery()));
goto error;
}
. . .