beautypg.com

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

Page 26

background image

TX/MAM Database Protocol Manual - document version: 2.2

– Page 26

8.6 Creating a record in the table with previously added fieldvalues

int cob_create_table_element( char *table, long long *id );


The new id will be returned in id.



Parameters

Name

Description

char *table

The table to update, e.g. "asset_element".

long long *id

The resulting id of the new record.



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

Value

Description

0

Success, the record has been created.

-1

Failure, the record could not be created.



Example
This example will create a new asset_element record with the id_category field and the
transfer_metadata already filled in:

cob_fieldlist_clear ();

cob_fieldlist_set_long( "id_category", 345, ORIGINAL_DATA );

cob_fieldlist_set_small_blob( "transfer_metadata", "",11, ORIGINAL_DATA );

if ( cob_create_table_element ( "asset_element", &new_id ) != 0){

/* Log error */

}