Source
int zbx_db_delete_template_elements(zbx_uint64_t hostid, const char *hostname, zbx_vector_uint64_t *del_templateids,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
typedef enum
{
SYSMAP_ELEMENT_TYPE_HOST = 0,
SYSMAP_ELEMENT_TYPE_MAP,
SYSMAP_ELEMENT_TYPE_TRIGGER,
SYSMAP_ELEMENT_TYPE_HOST_GROUP,
SYSMAP_ELEMENT_TYPE_IMAGE
}
zbx_sysmap_element_types_t;
typedef struct
{
zbx_uint64_t id;
char *name;
}
zbx_id_name_pair_t;
typedef struct
{
zbx_uint64_t ugsetid;
int permission;
} zbx_hgset_permission_t;
ZBX_VECTOR_DECL(hgset_permission, zbx_hgset_permission_t)
ZBX_VECTOR_IMPL(hgset_permission, zbx_hgset_permission_t)
static zbx_hash_t zbx_ids_names_hash_func(const void *data)
{
const zbx_id_name_pair_t *id_name_pair_entry = (const zbx_id_name_pair_t *)data;
return ZBX_DEFAULT_UINT64_HASH_ALGO(&(id_name_pair_entry->id), sizeof(id_name_pair_entry->id),
ZBX_DEFAULT_HASH_SEED);
}
static int zbx_ids_names_compare_func(const void *d1, const void *d2)
{
const zbx_id_name_pair_t *id_name_pair_entry_1 = (const zbx_id_name_pair_t *)d1;
const zbx_id_name_pair_t *id_name_pair_entry_2 = (const zbx_id_name_pair_t *)d2;
ZBX_RETURN_IF_NOT_EQUAL(id_name_pair_entry_1->id, id_name_pair_entry_2->id);
return 0;
}
/******************************************************************************
* *
* Parameters: sql - [IN] sql statement *
* ids - [OUT] sorted list of selected uint64 values *
* names - [OUT] list of names of the requested resource, order *
* matches the order of ids list *
* *
* Return value: SUCCEED - query for selecting ids and names SUCCEEDED *
* FAIL - otherwise *