Source
res = zbx_db_execute("update profiles set value_str='name' where idx='web.problem.sort' and value_str='problem'");
/*
** 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.
**/
/*
* 4.0 development database patches
*/
static int DBpatch_3050000(void)
{
const ZBX_FIELD field = {"proxy_address", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBadd_field("hosts", &field);
}
static int DBpatch_3050001(void)
{
DB_RESULT result;
DB_ROW row;
int ret = FAIL;
/* type : 'problem' - WIDGET_PROBLEMS */
result = zbx_db_select(
"select wf.widgetid,wf.name"
" from widget w,widget_field wf"
" where w.widgetid=wf.widgetid"
" and w.type='problems'"
" and wf.name like 'tags.tag.%%'");
while (NULL != (row = zbx_db_fetch(result)))
{
const char *p;
int index;
zbx_uint64_t widget_fieldid;
if (NULL == (p = strrchr(row[1], '.')) || SUCCEED != zbx_is_uint31(p + 1, &index))
continue;
widget_fieldid = zbx_db_get_maxid_num("widget_field", 1);
/* type : 0 - ZBX_WIDGET_FIELD_TYPE_INT32 */
/* value_int : 0 - TAG_OPERATOR_LIKE */
if (ZBX_DB_OK > zbx_db_execute(
"insert into widget_field (widget_fieldid,widgetid,type,name,value_int)"
"values (" ZBX_FS_UI64 ",%s,0,'tags.operator.%d',0)", widget_fieldid, row[0], index)) {
goto clean;
}
}
ret = SUCCEED;
clean:
zbx_db_free_result(result);
return ret;
}
static int DBpatch_3050004(void)
{
const ZBX_FIELD field = {"name", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
if (SUCCEED != DBadd_field("events", &field))
return FAIL;
return SUCCEED;
}