beautypg.com

Grass Valley K2 TX/MAM Database Protocol Manual v.2.2 User Manual

Page 16

background image

TX/MAM Database Protocol Manual - document version: 2.2

– Page 16

7.2 Adding a field request for an integer database field

The result is temporarily placed in a library variable. Copy to a local variable to save this value even
after a cob_fieldlist_clear call.

int cob_fieldlist_get_integer( char *field, int **result_target, int data_type );



Parameters

Name

Description

char *field

The field to get, e.g. "status".

int **result_target

The pointer to the pointer that contains the result, e.g. _status_int with
the declaration int *_status_int;.

int data_type

The origin of the data, e.g. ORIGINAL_DATA.



Result
The result of the function is an integer and has following possible values:

Value

Description

0

Success, the field has been added.

-1

Failure, the field could not be added.



Example
This example will retrieve details for the asset_element record with id == 1035:

char *_artist;

int *_status_int;

long long *_id_category;

char artist[256];

int status_int;

long long category_id;

[..]

cob_fieldlist_clear();

cob_fieldlist_get_long( "id_category", &_id_category,ORIGINAL_DATA );

cob_fieldlist_get_string( "artist", &_artist, CUSTOM_DATA );

cob_fieldlist_get_integer( "status_int", &_status_int, ORIGINAL_DATA );

result = cob_get_field_values( "asset_element", 1035 );

if ( result == -1 ) {

printf( "Can't find asset_element: %Ld -> exit \n", 1035 );

return -1;

}

category_id = *_id_category;

strcpy( _artist, artist );

status_int = *_status_int;