Source
/*
** 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.
**/
/*
* 5.4 development database patches
*/
static int DBpatch_5030000(void)
{
if (0 == (DBget_program_type() & ZBX_PROGRAM_TYPE_SERVER))
return SUCCEED;
if (ZBX_DB_OK > zbx_db_execute("delete from profiles where idx='web.queue.config'"))
return FAIL;
return SUCCEED;
}
typedef struct
{
zbx_uint64_t id;
zbx_uint64_t userid;
char *idx;
zbx_uint64_t idx2;
zbx_uint64_t value_id;
int value_int;
char *value_str;
char *source;
int type;
}
zbx_dbpatch_profile_t;
static void DBpatch_get_key_fields(DB_ROW row, zbx_dbpatch_profile_t *profile, char **subsect, char **field, char **key)
{
int tok_idx = 0;
char *token;
ZBX_DBROW2UINT64(profile->id, row[0]);
ZBX_DBROW2UINT64(profile->userid, row[1]);
profile->idx = zbx_strdup(profile->idx, row[2]);
ZBX_DBROW2UINT64(profile->idx2, row[3]);
ZBX_DBROW2UINT64(profile->value_id, row[4]);
profile->value_int = atoi(row[5]);
profile->value_str = zbx_strdup(profile->value_str, row[6]);
profile->source = zbx_strdup(profile->source, row[7]);
profile->type = atoi(row[8]);
token = strtok(profile->idx, ".");
while (NULL != token)
{
token = strtok(NULL, ".");
tok_idx++;
if (1 == tok_idx)
{
*subsect = zbx_strdup(*subsect, token);