beautypg.com

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

Page 14

background image

TX/MAM Database Protocol Manual - document version: 2.2

– Page 14

6.7 Retrieving the list of IDs that are the result of evaluating the

previously added criteria

int cob_get_id_list( long long *id_list, int max_ids );



Parameters

Name

Description

long long *id_list

The pointer to the list in which the resulting list will be placed. This list is an
array of 'long long', e.g. 'long long asset_element_array [ MAX_IDS ];'

int max_ids

The maximum number of rows to return, e.g 1024.



Result
The result of the function is an integer that can have following values:

Value

Description

>=0

Success, the number indicates the number of rows that were returned.

-1

Failure, retrieving the list failed.



Example
This example will retrieve a list of all asset_elements with an asset_string value that equals "Clips"
and with status_int value that equals 1:

cob_criteria_clear();

cob_criteria_add_sqlquery( "asset_element","select id, save_stamp from asset_element where "

"asset_string = :asset_string and status_int = 1" );

cob_criteria_add_sqlparam( "asset_element" , "asset_string", "Clips" );

number_of_ids = cob_get_id_list( id_array, max_id_size );

if ( number_of_ids >= 0 ){

/* continue with the rest of the applet by looping through the array */

} else {

/* failure, log the error and stop */

}