mcDBgetSubset, mcDBgetSubsetArray — Read sub-set from database
#include <memcom.h> void* mcDBgetSubset(int handle, const char* name, mcOff idiv, mcSize size); int mcDBgetSubsetArray(int handle, const char* name, mcOff idiv, mcSize size, *void array);
mcDBgetSubset
retrieves a sub-set of a
dataset from a database. 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
mcDBgetSubset
by means of the mcDBfree
. Note that
relational tables must be freed by means of mcTBfree
.
mcDBgetSubsetArray
retrieves a dataset from a
database to a pre-allocated array in memory. If completed
successfully, the function returns 0. Otherwise, a negative value
indicating the MemCom error number is
returned. Note that character arrays, i.e arrays of type
K
, are NULL-terminated.
handle
Database handle (input).
name
Dataset name (input).
idiv
Sub-set identifier of sub-set to be read (input). If set to 0, the beginning of the set will be addressed.
size
Number of data elements to be read (input). If set to 0, the entire sub-set will be read in memory.
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!