diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-07 00:01:13 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-07 00:01:13 +0000 |
commit | b97983a452f7caea7f79c260f89f5cb2d54a9466 (patch) | |
tree | a703c9dcba66d1632e1c504d92deb6100ced27b9 /src | |
parent | d3df28b936d259b8d3e91deeeba2104e87dffc8c (diff) | |
download | zabbix-b97983a452f7caea7f79c260f89f5cb2d54a9466.tar.gz zabbix-b97983a452f7caea7f79c260f89f5cb2d54a9466.tar.xz zabbix-b97983a452f7caea7f79c260f89f5cb2d54a9466.zip |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2814 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r-- | src/zabbix_server/evalfunc.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/zabbix_server/evalfunc.c b/src/zabbix_server/evalfunc.c index 88a2d6f5..e8b0252c 100644 --- a/src/zabbix_server/evalfunc.c +++ b/src/zabbix_server/evalfunc.c @@ -67,6 +67,7 @@ static int evaluate_LOGSOURCE(char *value, DB_ITEM *item, char *parameter) { DB_RESULT result; + DB_ROW row; char sql[MAX_STRING_LEN]; int now; @@ -82,14 +83,16 @@ static int evaluate_LOGSOURCE(char *value, DB_ITEM *item, char *parameter) snprintf(sql,sizeof(sql)-1,"select source from history_log where itemid=%d order by clock desc limit 1",item->itemid); result = DBselect(sql); - if(DBnum_rows(result) == 0) + row = DBfetch(result); + + if(!row) { zabbix_log(LOG_LEVEL_DEBUG, "Result for LOGSOURCE is empty" ); res = FAIL; } else { - if(strcmp(DBget_field(result,0,0), parameter) == 0) + if(strcmp(row[0], parameter) == 0) { strcpy(value,"1"); } @@ -123,6 +126,7 @@ static int evaluate_LOGSOURCE(char *value, DB_ITEM *item, char *parameter) static int evaluate_LOGSEVERITY(char *value, DB_ITEM *item, char *parameter) { DB_RESULT result; + DB_ROW row; char sql[MAX_STRING_LEN]; int now; @@ -138,14 +142,15 @@ static int evaluate_LOGSEVERITY(char *value, DB_ITEM *item, char *parameter) snprintf(sql,sizeof(sql)-1,"select severity from history_log where itemid=%d order by clock desc limit 1",item->itemid); result = DBselect(sql); - if(DBnum_rows(result) == 0) + row = DBfetch(result); + if(!row) { zabbix_log(LOG_LEVEL_DEBUG, "Result for LOGSEVERITY is empty" ); res = FAIL; } else { - strcpy(value,DBget_field(result,0,0)); + strcpy(value,row[0]); } DBfree_result(result); @@ -172,6 +177,7 @@ static int evaluate_LOGSEVERITY(char *value, DB_ITEM *item, char *parameter) static int evaluate_COUNT(char *value, DB_ITEM *item, int parameter) { DB_RESULT result; + DB_ROW row; char sql[MAX_STRING_LEN]; int now; @@ -187,14 +193,16 @@ static int evaluate_COUNT(char *value, DB_ITEM *item, int parameter) snprintf(sql,sizeof(sql)-1,"select count(value) from history where clock>%d and itemid=%d",now-parameter,item->itemid); result = DBselect(sql); - if(DBnum_rows(result) == 0) + row = DBfetch(result); + + if(!row) { zabbix_log(LOG_LEVEL_DEBUG, "Result for COUNT is empty" ); res = FAIL; } else { - strcpy(value,DBget_field(result,0,0)); + strcpy(value,row[0]); } DBfree_result(result); |