Source
const zbx_db_field_t field = {"default_theme", "blue-theme", NULL, NULL, 128, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
/*
** 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/>.
**/
/*
* 3.0 development database patches
*/
static int DBpatch_2050000(void)
{
const zbx_db_field_t field = {"agent", "Zabbix", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBset_default("httptest", &field);
}
static int DBpatch_2050001(void)
{
zbx_db_result_t result;
zbx_db_row_t row;
char *oid = NULL;
size_t oid_alloc = 0;
int ret = FAIL, rc;
/* flags - ZBX_FLAG_DISCOVERY_RULE */
/* type - ITEM_TYPE_SNMPv1, ITEM_TYPE_SNMPv2c, ITEM_TYPE_SNMPv3 */
if (NULL == (result = zbx_db_select("select itemid,snmp_oid from items where flags=1 and type in (1,4,6)")))
return FAIL;
while (NULL != (row = zbx_db_fetch(result)))
{
char *param, *oid_esc;
size_t oid_offset = 0;
param = zbx_strdup(NULL, row[1]);
zbx_snprintf_alloc(&oid, &oid_alloc, &oid_offset, "discovery[{#SNMPVALUE},%s]", param);
if (FAIL == zbx_quote_key_param(¶m, 0))
{
zabbix_log(LOG_LEVEL_WARNING, "cannot convert SNMP discovery OID \"%s\":"
" OID contains invalid character(s)", row[1]);
rc = ZBX_DB_OK;
}
else if (255 < oid_offset && 255 < zbx_strlen_utf8(oid)) /* 255 - ITEM_SNMP_OID_LEN */
{
zabbix_log(LOG_LEVEL_WARNING, "cannot convert SNMP discovery OID \"%s\":"
" resulting OID is too long", row[1]);
rc = ZBX_DB_OK;
}
else
{
oid_esc = zbx_db_dyn_escape_string(oid);
rc = zbx_db_execute("update items set snmp_oid='%s' where itemid=%s", oid_esc, row[0]);
zbx_free(oid_esc);
}
zbx_free(param);
if (ZBX_DB_OK > rc)
goto out;
}
ret = SUCCEED;
out:
zbx_db_free_result(result);
zbx_free(oid);
return ret;
}
static int DBpatch_2050002(void)
{