zabbix-agent2/src/libs/zbxdbcache/dbsync.c
/******************************************************************************
 *                                                                            *
 * Function: dbsync_compare_trigger                                           *
 *                                                                            *
 * Purpose: compares triggers table row with cached configuration data        *
 *                                                                            *
 * Parameter: trigger - [IN] the cached trigger                               *
 *            dbrow   - [IN] the database row                                 *
 *                                                                            *
 * Return value: SUCCEED - the row matches configuration data                 *
 *               FAIL    - otherwise                                          *
 *                                                                            *
 ******************************************************************************/
dbsync_compare_trigger

Purpose: compares triggers table row with cached configuration data

Parameter: trigger - [IN] the cached trigger
dbrow   - [IN] the database row

Return value: SUCCEED - the row matches configuration data
FAIL    - otherwise
dbsync_compare_trigger Purpose : compares triggers table row with cached configuration data Parameter : trigger - [ IN ] the cached trigger dbrow - [ IN ] the database row Return value : SUCCEED - the row matches configuration data FAIL - otherwise
static int	dbsync_compare_trigger(const ZBX_DC_TRIGGER *trigger, const DB_ROW dbrow)
{
	if (FAIL == dbsync_compare_str(dbrow[1], trigger->description))
		return FAIL;
	if (FAIL == dbsync_compare_str(dbrow[2], trigger->expression))
		return FAIL;
	if (FAIL == dbsync_compare_uchar(dbrow[4], trigger->priority))
		return FAIL;
	if (FAIL == dbsync_compare_uchar(dbrow[5], trigger->type))
		return FAIL;
	if (FAIL == dbsync_compare_uchar(dbrow[9], trigger->status))
		return FAIL;
	if (FAIL == dbsync_compare_uchar(dbrow[10], trigger->recovery_mode))
		return FAIL;
	if (FAIL == dbsync_compare_str(dbrow[11], trigger->recovery_expression))
		return FAIL;
	if (FAIL == dbsync_compare_uchar(dbrow[12], trigger->correlation_mode))
		return FAIL;
	if (FAIL == dbsync_compare_str(dbrow[13], trigger->correlation_tag))
		return FAIL;
	if (FAIL == dbsync_compare_str(dbrow[14], trigger->opdata))
		return FAIL;
	if (FAIL == dbsync_compare_str(dbrow[15], trigger->event_name))
		return FAIL;
	if (FAIL == dbsync_compare_serialized_expression(dbrow[16], trigger->expression_bin))
		return FAIL;
	if (TRIGGER_RECOVERY_MODE_RECOVERY_EXPRESSION == atoi(dbrow[10]) &&
			FAIL == dbsync_compare_serialized_expression(dbrow[17], trigger->recovery_expression_bin))
	{
		return FAIL;
	}
	return SUCCEED;
}
static int dbsync_compare_trigger ( const ZBX_DC_TRIGGER * trigger , const DB_ROW dbrow ) { if ( FAIL == dbsync_compare_str ( dbrow [ 1 ] , trigger -> description ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 2 ] , trigger -> expression ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 4 ] , trigger -> priority ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 5 ] , trigger -> type ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 9 ] , trigger -> status ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 10 ] , trigger -> recovery_mode ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 11 ] , trigger -> recovery_expression ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 12 ] , trigger -> correlation_mode ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 13 ] , trigger -> correlation_tag ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 14 ] , trigger -> opdata ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 15 ] , trigger -> event_name ) ) return FAIL ; if ( FAIL == dbsync_compare_serialized_expression ( dbrow [ 16 ] , trigger -> expression_bin ) ) return FAIL ; if ( TRIGGER_RECOVERY_MODE_RECOVERY_EXPRESSION == atoi ( dbrow [ 10 ] ) && FAIL == dbsync_compare_serialized_expression ( dbrow [ 17 ] , trigger -> recovery_expression_bin ) ) { return FAIL ; } return SUCCEED ; }
Function: dbsync_compare_trigger                                           
                                                                            
 Purpose: compares triggers table row with cached configuration data        
                                                                            
 Parameter: trigger - [IN] the cached trigger                               
            dbrow   - [IN] the database row                                 
                                                                            
 Return value: SUCCEED - the row matches configuration data                 
               FAIL    - otherwise
Function : dbsync_compare_trigger Purpose : compares triggers table row with cached configuration data Parameter : trigger - [ IN ] the cached trigger dbrow - [ IN ] the database row Return value : SUCCEED - the row matches configuration data FAIL - otherwise