Source
zabbix_log(LOG_LEVEL_INFORMATION, "%s #%d started [%s #%d]", get_program_type_string(info->program_type),
/*
** Copyright (C) 2001-2024 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/>.
**/
static void dbsync_item_rtname(zbx_vector_uint64_t *hostids, int *processed_num, int *updated_num,
int *macro_used)
{
zbx_db_result_t result;
zbx_db_row_t row;
zbx_dc_um_handle_t *um_handle;
char *sql = NULL;
size_t sql_alloc = 0, sql_offset = 0;
char *sql_select = NULL;
size_t sql_select_alloc = 0;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
if (0 == hostids->values[0])
{
if (0 == *macro_used)
zbx_vector_uint64_remove(hostids, 0);
else
hostids->values_num = 1;
if (0 == hostids->values_num)
goto out;
}
um_handle = zbx_dc_open_user_macros();
zbx_db_begin();
for (zbx_uint64_t *batch = hostids->values; batch < hostids->values + hostids->values_num;
batch += ZBX_DBCONFIG_BATCH_SIZE)
{
int batch_size = MIN(ZBX_DBCONFIG_BATCH_SIZE, hostids->values + hostids->values_num - batch);
size_t sql_select_offset = 0;