Source
xxxxxxxxxx
result = zbx_db_select("select a.clock,a.alerttype,a.status,mt.name,a.sendto,a.error,a.esc_step,a.userid,a.message"
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/******************************************************************************
* *
* Purpose: request proxy field value by proxyid. *
* *
* Return value: upon successful completion return SUCCEED *
* otherwise FAIL *
* *
******************************************************************************/
int expr_db_get_proxy_value(zbx_uint64_t proxyid, char **replace_to, const char *field_name)
{
zbx_db_result_t result;
zbx_db_row_t row;
int ret = FAIL;
result = zbx_db_select(
"select %s"
" from proxy"
" where proxyid=" ZBX_FS_UI64,
field_name, proxyid);
if (NULL != (row = zbx_db_fetch(result)))
{
*replace_to = zbx_strdup(*replace_to, row[0]);
ret = SUCCEED;
}
zbx_db_free_result(result);
return ret;
}
/******************************************************************************
* *
* Purpose: get template trigger ID from which the trigger is inherited. *
* *
* Return value: upon successful completion return SUCCEED *
* otherwise FAIL *
* *
******************************************************************************/
int expr_db_get_templateid_by_triggerid(zbx_uint64_t triggerid, zbx_uint64_t *templateid)
{
zbx_db_result_t result;
zbx_db_row_t row;
int ret = FAIL;
result = zbx_db_select(
"select templateid"
" from triggers"
" where triggerid=" ZBX_FS_UI64,
triggerid);
if (NULL != (row = zbx_db_fetch(result)))
{
ZBX_DBROW2UINT64(*templateid, row[0]);
ret = SUCCEED;
}
zbx_db_free_result(result);