User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v8.0.x:api:ubf:cbvgetalloc.3

cbvgetalloc

Name

CBvgetalloc — Allocate buffer space, get and convert to user type data from VIEW buffer field

Synopsis

#include <ubf.h>

char * CBvget(char *cstruct, char *view, char *cname, BFLDOCC occ, int usrtype, long flags, BFLDLEN *extralen);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Function is used to get field data dynamically from VIEW buffer. cstruct is pointer to C structure instance (object), view is name of the VIEW (must match the instance of the object), occ is field array occurrence, if field is not an array or first array element must be read, then use occ=0. usrtype is user type indicating the data type to which data shall be converted before returning. If types are different, the automatic data conversion is performed. flags is either set to 0 in which case data is returned as is in the VIEW, does not matter if it matches the NULL value specified in VIEW file or not, the exact value is returned. If flag BVACCESS_NOTNULL is specified, then if value in field matches NULL column in view file, then error BNOTPRES is returned. BNOTPRES can be returned in case if C flag was set in view file, and the count indicator is set to less than occurrence specified. Data is returned to allocated buffer. extralen is optional field. On input it indicates additional space that shall be allocated with the data. On output it indicates actual bytes copied of the data.

RETURN VALUE

On success, CBvgetalloc() ptr to data; on error, NULL is returned, with Berror set to indicate the error.

ERRORS

Note that Bstrerror() returns generic error message plus custom message with debug info from last function call, stored in thread local storage (TLS).

BEINVAL view, cstruct or buf is NULL. view or cname is empty string (first byte 0x00). Or occurrence is out of bounds of the array declaration.

BBADVIEW invalid view name (not found in view file).

BNOCNAME field name (cname) not found in view structure.

BNOSPACE No space in buf.

BMALLOC Failed to allocate type conversion buffer.

BNOTPRES Field not present (in case field value matches NULL in view file and BVACCESS_NOTNULL is set or count (C_) field is less than occurrence requested.

EXAMPLE

See atmitest/test040_typedview/vaccget.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd