mcTBload, mcTBloadAll — Load relational table
#include <memcom.h> mcRTable* mcTBload(int handle, const char* name, mcOff idiv); mcRTable* rt = mcTBloadAll(int handle, const char* name, mcOff start, mcOff ntables);
mcTBload
loads a relational table from a
database in memory, creating a structure of type
mcRTable
. If a sub-table is selected, i.e
idiv > 0
, only one sub-table can be loaded at
the time. If completed successfully, the function returns a pointer
to the table in memory. Otherwise, 0
is returned
and the error code can be retrieved by the function
mcerrstatus
. To free the table from memory make
use of mcTBfree
.
mcTBloadAll
loads one or more relational
tables stored in sub-sets of a dataset from a database in memory,
creating an array of mcRTable
relational tables.
The function works only for datasets containing sub-tables and
stored in a contiguous way. If completed successfully, the function
returns a pointer to the array of tables in memory. Otherwise, 0 is
returned and the error code can be retrieved by the function
mcErrStatus
. To remove the array from memory,
make use of mcTBfreeAll
for the whole
array, which will remove all elements of the array. Warning: The
elements mcRTable
of this array returned by this
function must be referenced by
&x[i]
(x
being the array
name and i
the i-th element of that array) when
processing the sub-table by any of the mcTB
functions.
Both mcTBload
and
mcTBloadAll
also support reading rows of
sparse-table datasets. It is worth mentioning that using the sparse-table functions instead of
mcTBload
and mcTBloadAll
for sub-tables will result in better performance.
handle
Database handle (input).
name
Name of relational table to be loaded in memory (input).
idiv
Index of sub-table to be retrieved,
mcTBload
only (input). If no sub-table
has been defined, i.e idiv=0
the
sub-table is ignored. If a sub-table has been defined,
idiv
must be in the range of 1 to the
number of defined sub-tables.
For sparse-table datasets, idiv
must be positive and smaller or equal to the number of rows
of the dataset.
start
Start index of sub-table to be retrieved (input),
mcTBloadAll
only.
For sparse-table datasets, start
must be positive and smaller or equal to the number of rows
of the dataset.
ntables
Number of sub-table to be retrieved (input),
mcTBloadAll
only.