mcDBgetSetpos, mcDBgetSetposArray — Read set by position from database
#include <memcom.h> void* mcDBgetSetpos(int handle, const char* name, mcOff pos, mcSize size); int mcDBgetSetposArray(int handle, const char* name, mcOff pos, mcSize size, void* array);
mcDBgetSetpos
retrieves a portion of a
dataset from a database. The data type corresponds to the data type
of the set. The data are read from the database relative to the
beginning of the set on database, i.e with an offset of
pos
data elements. If completed successfully, the
function returns a pointer to a new array containing the requested
data. Otherwise, NULL
is returned and the error
code can be retrieved by the function
mcErrStatus
.
It is strongly advised to free data allocated with
mcDBgetSet
by means of the mcDBfree.
mcDBgetSetposArray
performs the same function as
mcDBgetSetpos
but the receiving data array must
be pre-allocated in memory before calling the function. If completed
successfully, the function returns 0. Otherwise, a negative value
indicating the MemCom error number is
returned.
handle
Database handle (input).
name
Dataset name (input).
pos
Position of the first data element on the database to be read (input). The position is relative to beginning of the dataset on database, the first index being 1.
size
Size of dataset to be read (input).
size
must be greater than zero.
array
Address of array to which set is copied (input). The calling function must make sure that the array is large enough to hold the data of specific type!