MemCom Reference Manual > MemCom C API Manual Pages > Sparse Table Functions > mcSTcolAppend

Name

mcSTcolAppend — Append a new column to a sparse-table dataset

Synopsis

#include <memcom.h>

mcInt64 mcSTcolAppend(int dsid, const char* name, 
                      const char* type, mcInt64 num_elements);

Description

mcSTcolAppend appends, for the sparse-table dataset identified by dsid, a new column whose name is defined by name, whose data type is defined by type, and whose number of data elements is defined by num_elements. If a column with the same name is already defined, its attributes are cross-checked against type and num_elements, and the column index of that column will be returned.

Parameters

dsid (input)

Dataset identifier.

name (input)

Pointer to a NUL-terminated character string containing the name of the column. The length of the string including the NUL-character must not exceed 64 bytes. Column names are unique per dataset.

type (input)

Pointer to a NUL-terminated character string containing the data element type for the column. Valid choices are "I", "J", "E", "F", "C", "Z", and "K".

num_elements (input)

Defines the number of data elements for the column. If positive, indicates a fixed-sized column. In this case, all cells of this column are arrays of num_elements elements. If 0, indicates a variable-sized column. where each cell belonging to this column may have a different number of data elements.

Return Value

If the column could be added successfully or if the column already exists and its attributes match, the column index (starting from 1) is returned. If the column is new, the returned column index is equal to the current number of columns, as obtained by calling mcSTcolNum.

In case of error, a negative value indicating the MemCom error number is returned.

See Also

mcSTdatasetClear, mcSTcolNum