zabbix-agent2/src/libs/zbxdbcache/dbsync.c
/******************************************************************************
 *                                                                            *
 * Function: dbsync_compare_corr_condition                                    *
 *                                                                            *
 * Purpose: compares correlation condition tables dbrow with cached             *
 *          configuration data                                                *
 *                                                                            *
 * Parameter: corr_condition - [IN] the cached correlation condition          *
 *            dbrow          - [IN] the database row                          *
 *                                                                            *
 * Return value: SUCCEED - the row matches configuration data                 *
 *               FAIL    - otherwise                                          *
 *                                                                            *
 ******************************************************************************/
dbsync_compare_corr_condition

Purpose: compares correlation condition tables dbrow with cached
configuration data

Parameter: corr_condition - [IN] the cached correlation condition
dbrow          - [IN] the database row

Return value: SUCCEED - the row matches configuration data
FAIL    - otherwise
dbsync_compare_corr_condition Purpose : compares correlation condition tables dbrow with cached configuration data Parameter : corr_condition - [ IN ] the cached correlation condition dbrow - [ IN ] the database row Return value : SUCCEED - the row matches configuration data FAIL - otherwise
static int	dbsync_compare_corr_condition(const zbx_dc_corr_condition_t *corr_condition, const DB_ROW dbrow)
{
	if (FAIL == dbsync_compare_uint64(dbrow[1], corr_condition->correlationid))
		return FAIL;
	if (FAIL == dbsync_compare_uchar(dbrow[2], corr_condition->type))
		return FAIL;
	switch (corr_condition->type)
	{
		case ZBX_CORR_CONDITION_OLD_EVENT_TAG:
		case ZBX_CORR_CONDITION_NEW_EVENT_TAG:
			if (FAIL == dbsync_compare_str(dbrow[3], corr_condition->data.tag.tag))
				return FAIL;
			break;
		case ZBX_CORR_CONDITION_OLD_EVENT_TAG_VALUE:
		case ZBX_CORR_CONDITION_NEW_EVENT_TAG_VALUE:
			if (FAIL == dbsync_compare_str(dbrow[4], corr_condition->data.tag_value.tag))
				return FAIL;
			if (FAIL == dbsync_compare_str(dbrow[5], corr_condition->data.tag_value.value))
				return FAIL;
			if (FAIL == dbsync_compare_uchar(dbrow[6], corr_condition->data.tag_value.op))
				return FAIL;
			break;
		case ZBX_CORR_CONDITION_NEW_EVENT_HOSTGROUP:
			if (FAIL == dbsync_compare_uint64(dbrow[7], corr_condition->data.group.groupid))
				return FAIL;
			if (FAIL == dbsync_compare_uchar(dbrow[8], corr_condition->data.group.op))
				return FAIL;
			break;
		case ZBX_CORR_CONDITION_EVENT_TAG_PAIR:
			if (FAIL == dbsync_compare_str(dbrow[9], corr_condition->data.tag_pair.oldtag))
				return FAIL;
			if (FAIL == dbsync_compare_str(dbrow[10], corr_condition->data.tag_pair.newtag))
				return FAIL;
			break;
	}
	return SUCCEED;
}
static int dbsync_compare_corr_condition ( const zbx_dc_corr_condition_t * corr_condition , const DB_ROW dbrow ) { if ( FAIL == dbsync_compare_uint64 ( dbrow [ 1 ] , corr_condition -> correlationid ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 2 ] , corr_condition -> type ) ) return FAIL ; switch ( corr_condition -> type ) { case ZBX_CORR_CONDITION_OLD_EVENT_TAG : case ZBX_CORR_CONDITION_NEW_EVENT_TAG : if ( FAIL == dbsync_compare_str ( dbrow [ 3 ] , corr_condition -> data . tag . tag ) ) return FAIL ; break ; case ZBX_CORR_CONDITION_OLD_EVENT_TAG_VALUE : case ZBX_CORR_CONDITION_NEW_EVENT_TAG_VALUE : if ( FAIL == dbsync_compare_str ( dbrow [ 4 ] , corr_condition -> data . tag_value . tag ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 5 ] , corr_condition -> data . tag_value . value ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 6 ] , corr_condition -> data . tag_value . op ) ) return FAIL ; break ; case ZBX_CORR_CONDITION_NEW_EVENT_HOSTGROUP : if ( FAIL == dbsync_compare_uint64 ( dbrow [ 7 ] , corr_condition -> data . group . groupid ) ) return FAIL ; if ( FAIL == dbsync_compare_uchar ( dbrow [ 8 ] , corr_condition -> data . group . op ) ) return FAIL ; break ; case ZBX_CORR_CONDITION_EVENT_TAG_PAIR : if ( FAIL == dbsync_compare_str ( dbrow [ 9 ] , corr_condition -> data . tag_pair . oldtag ) ) return FAIL ; if ( FAIL == dbsync_compare_str ( dbrow [ 10 ] , corr_condition -> data . tag_pair . newtag ) ) return FAIL ; break ; } return SUCCEED ; }
Function: dbsync_compare_corr_condition                                    
                                                                            
 Purpose: compares correlation condition tables dbrow with cached             
          configuration data                                                
                                                                            
 Parameter: corr_condition - [IN] the cached correlation condition          
            dbrow          - [IN] the database row                          
                                                                            
 Return value: SUCCEED - the row matches configuration data                 
               FAIL    - otherwise
Function : dbsync_compare_corr_condition Purpose : compares correlation condition tables dbrow with cached configuration data Parameter : corr_condition - [ IN ] the cached correlation condition dbrow - [ IN ] the database row Return value : SUCCEED - the row matches configuration data FAIL - otherwise
/* break; is not missing here */ /* break; is not missing here */