Source
/*
** 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 struct
{
zbx_uint32_t refs;
zbx_um_mock_cache_t mock_cache;
zbx_um_cache_t *cache;
}
zbx_mock_step_t;
ZBX_PTR_VECTOR_DECL(mock_step, zbx_mock_step_t *)
ZBX_PTR_VECTOR_IMPL(mock_step, zbx_mock_step_t *)
static void mock_step_free(zbx_mock_step_t *step)
{
zbx_uint32_t i;
um_mock_cache_clear(&step->mock_cache);
for (i = 0; i < step->refs; i++)
um_cache_release(step->cache);
zbx_free(step);
}
static void dbsync_check_empty(const char *entity, zbx_dbsync_t *sync)
{
unsigned char tag;
zbx_uint64_t rowid;
char **row;
char *errors[] = {"unknown", "added", "updated", "removed"};
if (SUCCEED == zbx_dbsync_next(sync, &rowid, &row, &tag))
{
char *msg = NULL;
size_t msg_alloc = 0, msg_offset = 0;
int i;
for (i = 0; i < sync->columns_num; i++)
zbx_snprintf_alloc(&msg, &msg_alloc, &msg_offset, "'%s',", row[i]);