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/>.
**/
/* mock field to estimate how much data can be stored in characters, bytes or both, */
/* depending on database backend */
typedef struct
{
int bytes_num;
int chars_num;
}
zbx_db_mock_field_t;
ZBX_PTR_VECTOR_IMPL(pp_result_ptr, zbx_pp_result_t *)
/******************************************************************************
* *
* Purpose: set result value *
* *
* Parameters: result - [OUT] result to set *
* value - [IN] field type in database schema *
* action - [IN] on fail action *
* value_raw - [IN] value before applying on fail action if *
* non-default action was applied. This value is *
* 'moved' over to result. *
* *
******************************************************************************/
void pp_result_set(zbx_pp_result_t *result, const zbx_variant_t *value, int action, zbx_variant_t *value_raw)
{
zbx_variant_copy(&result->value, value);
result->value_raw = *value_raw;
zbx_variant_set_none(value_raw);
result->action = action;
}
void zbx_pp_result_free(zbx_pp_result_t *result)
{
zbx_variant_clear(&result->value);
zbx_variant_clear(&result->value_raw);
zbx_free(result);
}
void pp_free_results(zbx_pp_result_t *results, int results_num)
{
for (int i = 0; i < results_num; i++)