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

Page 13

Advertising
background image

TX/MAM Database Protocol Manual - document version: 2.2

– Page 13

6.6 Adding a criterion that contains a parameter for a previously added

SQL-query

Only required for string fields

int cob_criteria_add_sqlparam( char *table, char *field, char *value );



Parameters

Name

Description

char *table

The table from which to use the field, e.g."asset_element".

char *field

The parameter name, e.g "asset_string".

char *value

The value of the parameter e.g. "Clips".



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

Value

Description

0

Success, the criterion has been added.

-1

Failure, the criterion could not be added.



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,savestamp 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 );

Advertising