zabbix-agent2/src/libs/zbxdbcache/dbsync.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_dbsync_compare_config                                        *
 *                                                                            *
 * Purpose: compares config table with cached configuration data              *
 *                                                                            *
 * Parameter: sync - [OUT] the changeset                                      *
 *                                                                            *
 * Return value: SUCCEED - the changeset was successfully calculated          *
 *               FAIL    - otherwise                                          *
 *                                                                            *
 ******************************************************************************/
zbx_dbsync_compare_config

Purpose: compares config table with cached configuration data

Parameter: sync - [OUT] the changeset

Return value: SUCCEED - the changeset was successfully calculated
FAIL    - otherwise
zbx_dbsync_compare_config Purpose : compares config table with cached configuration data Parameter : sync - [ OUT ] the changeset Return value : SUCCEED - the changeset was successfully calculated FAIL - otherwise
int	zbx_dbsync_compare_config(zbx_dbsync_t *sync)
{
	DB_RESULT	result;
#define SELECTED_CONFIG_FIELD_COUNT	33	/* number of columns in the following DBselect() */
	if (NULL == (result = DBselect("select discovery_groupid,snmptrap_logging,"
				"severity_name_0,severity_name_1,severity_name_2,"
				"severity_name_3,severity_name_4,severity_name_5,"
				"hk_events_mode,hk_events_trigger,hk_events_internal,"
				"hk_events_discovery,hk_events_autoreg,hk_services_mode,"
				"hk_services,hk_audit_mode,hk_audit,hk_sessions_mode,hk_sessions,"
				"hk_history_mode,hk_history_global,hk_history,hk_trends_mode,"
				"hk_trends_global,hk_trends,default_inventory_mode,db_extension,autoreg_tls_accept,"
				"compression_status,compress_older,instanceid,default_timezone,hk_events_service,"
				"auditlog_enabled"
			" from config"
			" order by configid")))	
	{
		return FAIL;
	}
	dbsync_prepare(sync, SELECTED_CONFIG_FIELD_COUNT, NULL);
	if (ZBX_DBSYNC_INIT == sync->mode)
	{
		sync->dbresult = result;
		return SUCCEED;
	}
	DBfree_result(result);
	THIS_SHOULD_NEVER_HAPPEN;
	return FAIL;
#undef SELECTED_CONFIG_FIELD_COUNT
}
int zbx_dbsync_compare_config ( zbx_dbsync_t * sync ) { DB_RESULT result ; #define SELECTED_CONFIG_FIELD_COUNT 	33	/* number of columns in the following DBselect() */
 if ( NULL == ( result = DBselect ( " " " " " " " " " " " " " " " " " " " " " " " " ) ) ) { return FAIL ; } dbsync_prepare ( sync , SELECTED_CONFIG_FIELD_COUNT , NULL ) ; if ( ZBX_DBSYNC_INIT == sync -> mode ) { sync -> dbresult = result ; return SUCCEED ; } DBfree_result ( result ) ; THIS_SHOULD_NEVER_HAPPEN ; return FAIL ; #undef  SELECTED_CONFIG_FIELD_COUNT
 }
Function: zbx_dbsync_compare_config                                        
                                                                            
 Purpose: compares config table with cached configuration data              
                                                                            
 Parameter: sync - [OUT] the changeset                                      
                                                                            
 Return value: SUCCEED - the changeset was successfully calculated          
               FAIL    - otherwise
Function : zbx_dbsync_compare_config Purpose : compares config table with cached configuration data Parameter : sync - [ OUT ] the changeset Return value : SUCCEED - the changeset was successfully calculated FAIL - otherwise
/* if you change number of columns in DBselect(), */ /* adjust SELECTED_CONFIG_FIELD_COUNT */ /* global configuration will be always synchronized directly with database */