summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-10-04 08:15:05 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-10-04 08:15:05 +0000
commitab34eae555def09b602bb4055b0394ff982a064f (patch)
tree798fd7556fcac25b78d6fe442fbd00c2bea88383 /src/libs
parentce0e258f52df4e0ac99a41d5e4d52894d3245503 (diff)
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2098 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/zbxdbhigh/Makefile.am2
-rw-r--r--src/libs/zbxdbhigh/host.c22
2 files changed, 19 insertions, 5 deletions
diff --git a/src/libs/zbxdbhigh/Makefile.am b/src/libs/zbxdbhigh/Makefile.am
index fe487d6f..256c29a2 100644
--- a/src/libs/zbxdbhigh/Makefile.am
+++ b/src/libs/zbxdbhigh/Makefile.am
@@ -1,4 +1,4 @@
SUBDIRS=
INCLUDES=-I@top_srcdir@/include @MYSQL_INCLUDE@ @PGSQL_INCLUDE@
lib_LIBRARIES=libzbxdbhigh.a
-libzbxdbhigh_a_SOURCES=db.c host.c
+libzbxdbhigh_a_SOURCES=host.c db.c
diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c
index 61485c81..42cf6d07 100644
--- a/src/libs/zbxdbhigh/host.c
+++ b/src/libs/zbxdbhigh/host.c
@@ -21,10 +21,6 @@
#include <stdlib.h>
#include <stdio.h>
-/* for setproctitle() */
-#include <sys/types.h>
-#include <unistd.h>
-
#include <string.h>
#include <strings.h>
@@ -53,3 +49,21 @@ int DBadd_new_host(char *server, int port, int status, int useip, char *ip, int
return hostid;
}
+
+int DBhost_exists(char *server)
+{
+ DB_RESULT *result;
+ char sql[MAX_STRING_LEN];
+ int ret = SUCCEED;
+
+ snprintf(sql,sizeof(sql)-1,"select hostid from hosts order where host='%s'", server);
+ result = DBselect(sql);
+
+ if(DBnum_rows(result) == 0)
+ {
+ ret = FAIL;
+ }
+ DBfree_result(result);
+
+ return ret;
+}