summaryrefslogtreecommitdiffstats
path: root/mod_log_sql.c
diff options
context:
space:
mode:
Diffstat (limited to 'mod_log_sql.c')
-rw-r--r--mod_log_sql.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/mod_log_sql.c b/mod_log_sql.c
index efbf45c..6780b74 100644
--- a/mod_log_sql.c
+++ b/mod_log_sql.c
@@ -1,11 +1,11 @@
1/* $Id: mod_log_sql.c,v 1.4 2001/12/07 03:52:56 helios Exp $ */ 1/* $Id: mod_log_sql.c,v 1.5 2002/01/15 18:40:14 helios Exp $ */
2 2
3 3
4/* DEFINES */ 4/* DEFINES */
5#define MYSQL_ERROR(mysql) ((mysql)?(mysql_error(mysql)):"MySQL server has gone away") 5#define MYSQL_ERROR(mysql) ((mysql)?(mysql_error(mysql)):"MySQL server has gone away")
6#define ERRLEVEL APLOG_ERR|APLOG_NOERRNO 6#define ERRLEVEL APLOG_ERR|APLOG_NOERRNO
7#define DEBUGLEVEL APLOG_INFO|APLOG_NOERRNO 7#define DEBUGLEVEL APLOG_INFO|APLOG_NOERRNO
8/* (DEBUG and WANT_SSL_LOGGING are defined in the Makefile DEFS line.) */ 8/* (MYSQLSOCKET, DEBUG and WANT_SSL_LOGGING are defined in the Makefile DEFS line.) */
9 9
10 10
11 11
@@ -245,7 +245,7 @@ static const char *extract_request_duration(request_rec *r, char *a)
245 245
246static const char *extract_virtual_host(request_rec *r, char *a) 246static const char *extract_virtual_host(request_rec *r, char *a)
247{ 247{
248 return pstrdup(r->pool, r->server->server_hostname); 248 return ap_get_server_name(r);
249} 249}
250 250
251static const char *extract_server_port(request_rec *r, char *a) 251static const char *extract_server_port(request_rec *r, char *a)
@@ -469,13 +469,8 @@ void open_logdb_link()
469 return; 469 return;
470 } 470 }
471 if (db_name) { /* open an SQL link */ 471 if (db_name) { /* open an SQL link */
472 mysql_log = mysql_connect(&sql_server, db_host, db_user, db_pwd); 472 mysql_init(&sql_server);
473 if (mysql_log) { /* link opened */ 473 mysql_log = mysql_real_connect(&sql_server, db_host, db_user, db_pwd, db_name, 0, MYSQLSOCKET, 0);
474 if (mysql_select_db(mysql_log, db_name) != 0) { /* unable to select database */
475 mysql_close(mysql_log);
476 mysql_log = NULL;
477 }
478 }
479 } 474 }
480} 475}
481 476