summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-01-19 15:20:11 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-01-19 15:20:11 +0000
commitd2d062b29fdd4795ea223837a63310d0b158fdea (patch)
treec981fdb4ff092b8a76667a606d1880b72190dafe /include
parentece248558937e4b57483d39165c803702fccdf31 (diff)
downloadzabbix-d2d062b29fdd4795ea223837a63310d0b158fdea.tar.gz
zabbix-d2d062b29fdd4795ea223837a63310d0b158fdea.tar.xz
zabbix-d2d062b29fdd4795ea223837a63310d0b158fdea.zip
- support for DB* parameters in zabbix_suckerd.conf (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@283 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
-rw-r--r--include/db.c11
-rw-r--r--include/db.h7
2 files changed, 8 insertions, 10 deletions
diff --git a/include/db.c b/include/db.c
index acb8f95f..9e3289b0 100644
--- a/include/db.c
+++ b/include/db.c
@@ -17,15 +17,16 @@
* Connect to database.
* If fails, program terminates.
*/
-void DBconnect( void )
+void DBconnect( char *dbname, char *dbuser, char *dbpassword)
{
+/* syslog(LOG_ERR, "[%s] [%s] [%s]\n",dbname, dbuser, dbpassword ); */
#ifdef HAVE_MYSQL
- if( ! mysql_connect( &mysql, NULL, DB_USER, DB_PASSWD ) )
+ if( ! mysql_connect( &mysql, NULL, dbuser, dbpassword ) )
{
syslog(LOG_ERR, "Failed to connect to database: Error: %s\n",mysql_error(&mysql) );
exit( FAIL );
}
- if( mysql_select_db( &mysql, DB_NAME ) != 0 )
+ if( mysql_select_db( &mysql, dbname ) != 0 )
{
syslog(LOG_ERR, "Failed to select database: Error: %s\n",mysql_error(&mysql) );
exit( FAIL );
@@ -33,12 +34,12 @@ void DBconnect( void )
#endif
#ifdef HAVE_PGSQL
/* conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); */
- conn = PQsetdb(NULL, NULL, NULL, NULL, DB_NAME);
+ conn = PQsetdb(NULL, NULL, NULL, NULL, dbname);
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD)
{
- syslog(LOG_ERR, "Connection to database '%s' failed.\n", DB_NAME);
+ syslog(LOG_ERR, "Connection to database '%s' failed.\n", dbname);
syslog(LOG_ERR, "%s", PQerrorMessage(conn));
exit(FAIL);
}
diff --git a/include/db.h b/include/db.h
index 2a71f2f2..fb1c8130 100644
--- a/include/db.h
+++ b/include/db.h
@@ -11,10 +11,6 @@
#include "libpq-fe.h"
#endif
-#define DB_NAME "zabbix"
-#define DB_USER "root"
-#define DB_PASSWD ""
-
#define DB_ITEM struct item_type
#define DB_TRIGGER struct trigger_type
#define DB_ACTION struct action_type
@@ -96,7 +92,8 @@ DB_ACTION
char *message;
};
-void DBconnect( void );
+
+void DBconnect( char *dbname, char *dbuser, char *dbpassword);
int DBexecute( char *query );