Source
records += delete_history("proxy_dhistory", "dhistory_lastid", now, config_offline_buffer, config_local_buffer);
/*
** 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: remove outdated information from historical table *
* *
* Parameters: table - [IN] *
* fieldname - [IN] *
* now - [IN] current timestamp *
* config_offline_buffer - [IN] hours to keep data when offline *
* config_local_buffer - [IN] hours to keep data *
* *
* Return value: number of rows records *
* *
******************************************************************************/
static int delete_history(const char *table, const char *fieldname, int now, int config_offline_buffer,
int config_local_buffer)
{
zbx_db_result_t result;
zbx_db_row_t row;
int records = 0;
zbx_uint64_t lastid, maxid;
char *condition = NULL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() table:'%s' now:%d", __func__, table, now);
zbx_db_begin();
result = zbx_db_select(
"select nextid"
" from ids"
" where table_name='%s'"