WYRDTEK Home Features Reference Downloads About


Reference/es_mbc_addfld

Syntax

int es_mbc_addfld( struct es_mbc *cls, const char *fieldnm, int ftype );

Arguments

struct es_mbc *cls A database class.
const char *fieldnm Field name.
int ftype Field type. Must be one of enumerated list of values below.

Return Codes

ES_ERROR_NONE Success. No errors.
ES_ERROR_FIELDEXISTS Field name already exists in class.
ES_ERROR_UNKNOWNFIELDTYPE Invalid field type.

Description

Add a field definition to a class. A field can be either numeric (integer or floating point), a reference to a node ( i.e. struct es_mbn* ) or a user-defined field. Integer fields can be designated as either 8bit, 16bit, 32bit or 64bits in size. Floating point fields are all double precision (64bits).

Character or string based data should be stored in a string dictionary (es_sd) and the corresponding integer stored as a numeric database field.

User-defined fields can be stored either as a pointer (void*) or as a fixed width blob of data up to 128 bytes in size.

Field Types

Each field requires a field type (int ftype) which can be one of the following:
ES_FLDTYPE_I8 8 bit integer.
ES_FLDTYPE_I16 16 bit integer.
ES_FLDTYPE_I32 32 bit integer.
ES_FLDTYPE_I64 64 bit integer.
ES_FLDTYPE_F64 64 bit double-precision floating point.
ES_FLDTYPE_MBN Node reference (struct es_mbn*). This is not a child node field (these are added automatically by es_mbc_new()) but can be used as a general reference to any node in the database.
ES_FLDTYPE_MBU User-defined field type stored as a pointer (void*). See es_mbc_addfldmbu().
ES_FLDTYPE_STR User-defined field type stored as a fixed width blob of data (typically type cast to a struct) up to 128 bytes in size. See es_mbc_addfldstr().

[Back To Reference] [Back To Reference/es_mbc]