summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-07-27 17:19:17 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-07-27 17:19:17 +0000
commit297e8dc29466989c96b89865a2e8fd02cdb7c155 (patch)
tree7fe203a1391d64245faec5b5b15bc286dde51ad5
parent916ce91d2d192e4cb99ac038abb27058ab098e35 (diff)
downloadzabbix-297e8dc29466989c96b89865a2e8fd02cdb7c155.tar.gz
zabbix-297e8dc29466989c96b89865a2e8fd02cdb7c155.tar.xz
zabbix-297e8dc29466989c96b89865a2e8fd02cdb7c155.zip
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@3077 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--src/zabbix_server/housekeeper/housekeeper.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/zabbix_server/housekeeper/housekeeper.c b/src/zabbix_server/housekeeper/housekeeper.c
index b717d9b9..8d69bada 100644
--- a/src/zabbix_server/housekeeper/housekeeper.c
+++ b/src/zabbix_server/housekeeper/housekeeper.c
@@ -213,7 +213,6 @@ static int housekeeping_alarms(int now)
******************************************************************************/
static int housekeeping_history_and_trends(int now)
{
- char sql[MAX_STRING_LEN];
DB_ITEM item;
DB_RESULT result;
@@ -223,8 +222,7 @@ static int housekeeping_history_and_trends(int now)
zabbix_log( LOG_LEVEL_DEBUG, "In housekeeping_history_and_trends(%d)", now);
- snprintf(sql,sizeof(sql)-1,"select itemid,history,delay,trends from items");
- result = DBselect(sql);
+ result = DBselect("select itemid,history,delay,trends from items");
while((row=DBfetch(result)))
{
@@ -239,39 +237,34 @@ static int housekeeping_history_and_trends(int now)
}
#ifdef HAVE_MYSQL
- snprintf(sql,sizeof(sql)-1,"delete from history where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
+ deleted += DBexecute("delete from history where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
- snprintf(sql,sizeof(sql)-1,"delete from history where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
+ deleted += DBexecute("delete from history where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
#endif
- deleted += DBexecute(sql);
#ifdef HAVE_MYSQL
- snprintf(sql,sizeof(sql)-1,"delete from history_uint where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
+ deleted += DBexecute("delete from history_uint where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
- snprintf(sql,sizeof(sql)-1,"delete from history_uint where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
+ deleted += DBexecute("delete from history_uint where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
#endif
- deleted += DBexecute(sql);
#ifdef HAVE_MYSQL
- snprintf(sql,sizeof(sql)-1,"delete from history_str where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
+ deleted += DBexecute("delete from history_str where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
- snprintf(sql,sizeof(sql)-1,"delete from history_str where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
+ deleted += DBexecute("delete from history_str where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
#endif
- deleted += DBexecute(sql);
#ifdef HAVE_MYSQL
- snprintf(sql,sizeof(sql)-1,"delete from history_log where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
+ deleted += DBexecute("delete from history_log where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
- snprintf(sql,sizeof(sql)-1,"delete from history_log where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
+ deleted += DBexecute("delete from history_log where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
#endif
- deleted += DBexecute(sql);
#ifdef HAVE_MYSQL
- snprintf(sql,sizeof(sql)-1,"delete from trends where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.trends,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
+ deleted += DBexecute("delete from trends where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.trends,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
- snprintf(sql,sizeof(sql)-1,"delete from trends where itemid=%d and clock<%d",item.itemid,now-24*3600*item.trends);
+ deleted += DBexecute("delete from trends where itemid=%d and clock<%d",item.itemid,now-24*3600*item.trends);
#endif
- deleted += DBexecute(sql);
}
DBfree_result(result);
return deleted;