summaryrefslogtreecommitdiffstats
path: root/mod_log_sql_mysql.c
diff options
context:
space:
mode:
authorGravatar Edward Rudd 2004-03-04 05:41:12 +0000
committerGravatar Edward Rudd 2004-03-04 05:41:12 +0000
commitec60974ca79594150b33692683b2d8bb800a896f (patch)
tree233cd2d8f4b60b7654840aa6206271e134bd05af /mod_log_sql_mysql.c
parentd28237cd2fff1922f86fb7576c22625f067d24e7 (diff)
complete DB separation from core module code.
99% updated documentation (needs 2 tables added) moved DB connection code for Apache 2 from open_logs to child_init. removed more #ifdef debug lines
Diffstat (limited to 'mod_log_sql_mysql.c')
-rw-r--r--mod_log_sql_mysql.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mod_log_sql_mysql.c b/mod_log_sql_mysql.c
index d0666fe..86c259a 100644
--- a/mod_log_sql_mysql.c
+++ b/mod_log_sql_mysql.c
@@ -1,4 +1,4 @@
1/* $Id: mod_log_sql_mysql.c,v 1.2 2004/03/02 05:34:50 urkle Exp $ */ 1/* $Id: mod_log_sql_mysql.c,v 1.3 2004/03/04 05:41:12 urkle Exp $ */
2#include "mysql.h" 2#include "mysql.h"
3#include "mysqld_error.h" 3#include "mysqld_error.h"
4 4
@@ -35,13 +35,19 @@ logsql_opendb_ret log_sql_mysql_connect(server_rec *s, logsql_dbconnection *db)
35 const char *user = apr_table_get(db->parms,"user"); 35 const char *user = apr_table_get(db->parms,"user");
36 const char *passwd = apr_table_get(db->parms,"passwd"); 36 const char *passwd = apr_table_get(db->parms,"passwd");
37 const char *database = apr_table_get(db->parms,"database"); 37 const char *database = apr_table_get(db->parms,"database");
38 unsigned int tcpport = atoi(apr_table_get(db->parms,"tcpport")); 38 const char *s_tcpport = apr_table_get(db->parms,"tcpport");
39 unsigned int tcpport = (s_tcpport)?atoi(s_tcpport):3306;
39 const char *socketfile = apr_table_get(db->parms,"socketfile"); 40 const char *socketfile = apr_table_get(db->parms,"socketfile");
40 MYSQL *dblink = db->handle; 41 MYSQL *dblink = db->handle;
41 42
42 dblink = mysql_init(dblink); 43 dblink = mysql_init(dblink);
43 db->handle = (void *)dblink; 44 db->handle = (void *)dblink;
44 45
46
47 if (!socketfile) {
48 socketfile = "/var/lib/mysql/mysql.sock";
49 }
50
45 if (mysql_real_connect(dblink, host, user, passwd, database, tcpport, 51 if (mysql_real_connect(dblink, host, user, passwd, database, tcpport,
46 socketfile, 0)) { 52 socketfile, 0)) {
47 log_error(APLOG_MARK,APLOG_DEBUG,s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'", 53 log_error(APLOG_MARK,APLOG_DEBUG,s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",