diff options
author | Edward Rudd | 2004-04-17 15:14:12 +0000 |
---|---|---|
committer | Edward Rudd | 2004-04-17 15:14:12 +0000 |
commit | 0eb391e9f9e44f15c03f1d8d5414c806413f50fb (patch) | |
tree | 256ecb77d74fa09b716f4497b6893a3f6f851284 | |
parent | 8ee3532f8b6c454f2600e6c3b47362d22b7cf536 (diff) |
beginnings of postgresql driver integrated into autoconf
removed log_error from apache20.h (aliased to ap_log_rerror)
-rw-r--r-- | Documentation/README | 3 | ||||
-rw-r--r-- | Documentation/manual.xml | 16 | ||||
-rw-r--r-- | INSTALL | 17 | ||||
-rw-r--r-- | Makefile.in | 22 | ||||
-rw-r--r-- | TODO.in | 11 | ||||
-rw-r--r-- | apache20.h | 11 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | functions.h | 1 | ||||
-rw-r--r-- | functions20.h | 2 | ||||
-rw-r--r-- | mod_log_sql.c | 18 | ||||
-rw-r--r-- | mod_log_sql.prj | 5 | ||||
-rw-r--r-- | mod_log_sql_mysql.c | 7 | ||||
-rw-r--r-- | mod_log_sql_pgsql.c | 28 | ||||
-rw-r--r-- | mod_log_sql_ssl.c | 4 |
14 files changed, 94 insertions, 57 deletions
diff --git a/Documentation/README b/Documentation/README index 7ff3241..dd40351 100644 --- a/Documentation/README +++ b/Documentation/README | |||
@@ -3,4 +3,5 @@ files here are derived from it. | |||
3 | 3 | ||
4 | To read the HTML docs, open manual.html in your browser. | 4 | To read the HTML docs, open manual.html in your browser. |
5 | 5 | ||
6 | To generate other formats of the documentation use xmlto to convert the xml file. | 6 | To generate other formats of the documentation use xmlto or your favorite |
7 | xslt docbook converter to convert the xml file. | ||
diff --git a/Documentation/manual.xml b/Documentation/manual.xml index d7dfc12..0490cc6 100644 --- a/Documentation/manual.xml +++ b/Documentation/manual.xml | |||
@@ -1,7 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <?xml-stylesheet href="file://localhost/home/urkle/Documents/DocBook/docbook.css" type="text/css"?> | 2 | <?xml-stylesheet href="/xslt/docbook.css" type="text/css"?> |
3 | <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "file:/usr/share/sgml/docbook/xml-dtd-4.1.2-1.0-8/docbookx.dtd" [ | 3 | <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "file:/usr/share/sgml/docbook/xml-dtd-4.1.2-1.0-8/docbookx.dtd" [ |
4 | <!ENTITY MaintainerContact "the maintainer, Edward Rudd at <email>eddie <at> omegaware <dot> com</email>"> | 4 | <!ENTITY EmailContact "<email>urkle <at> outoforder <dot> cc</email>"> |
5 | ]> | 5 | ]> |
6 | <article> | 6 | <article> |
7 | <articleinfo> | 7 | <articleinfo> |
@@ -12,7 +12,7 @@ | |||
12 | <contrib>Conversion from Lyx to DocBook</contrib> | 12 | <contrib>Conversion from Lyx to DocBook</contrib> |
13 | <contrib>Current Maintainer</contrib> | 13 | <contrib>Current Maintainer</contrib> |
14 | <affiliation> | 14 | <affiliation> |
15 | <address format="linespecific"><email>eddie <at> omegaware <dot> com</email></address> | 15 | <address format="linespecific">&EmailContact;</address> |
16 | </affiliation> | 16 | </affiliation> |
17 | </author> | 17 | </author> |
18 | <author> | 18 | <author> |
@@ -98,9 +98,13 @@ | |||
98 | <para>The actual logging code was taken from the already existing flat file text modules, so all that credit goes to the Apache Software Foundation.</para> | 98 | <para>The actual logging code was taken from the already existing flat file text modules, so all that credit goes to the Apache Software Foundation.</para> |
99 | <para>The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>. </para> | 99 | <para>The MySQL routines and directives were added by Zeev Suraski <bourbon@netvision.net.il>. </para> |
100 | <para>All changes from 1.06+ and the new documentation were added by Chris Powell <email>chris <at> grubbybaby <dot> com</email>. It seems that the module had fallen into the "un-maintained" category -- it had not been updated since 1998 -- so Chris adopted it as the new maintainer.</para> | 100 | <para>All changes from 1.06+ and the new documentation were added by Chris Powell <email>chris <at> grubbybaby <dot> com</email>. It seems that the module had fallen into the "un-maintained" category -- it had not been updated since 1998 -- so Chris adopted it as the new maintainer.</para> |
101 | <para>In December of 2003, Edward Rudd <email>eddie <at> omegaware <dot> com</email> porting the module to Apache 2.0, cleaning up the code, converting the documentation to DocBook, optimizing the main logging loop, and added the much anticipated database abstraction layer.</para> | 101 | <para>In December of 2003, Edward Rudd &EmailContact; porting the module to Apache 2.0, cleaning up the code, converting the documentation to DocBook, optimizing the main logging loop, and added the much anticipated database abstraction layer.</para> |
102 | <para>As of February 2004, Chris Powell handed over maintenance of the module over to Edward Rudd. So you should contact Edward Rudd about the module from now on.</para> | 102 | <para>As of February 2004, Chris Powell handed over maintenance of the module over to Edward Rudd. So you should contact Edward Rudd about the module from now on.</para> |
103 | </sect2> | 103 | </sect2> |
104 | <sect2 id="Sect.MailingLists"> | ||
105 | <title id="Sect.MailingLists.title">Mailing Lists</title> | ||
106 | <para>A general discussion and support mailing list is provided for mod_log_sq at lists.outoforder.cc. To subscribe to the mailing list send a blank e-mail to mod_log_sql-subscribe@lists.outoforder.cc. The list archives can be accessed via Gmane.org's mailng list gateway via any new reader <ulink url="news://news.gmane.org/gmane.comp.apache.mod-log-sql">news://news.gmane.org/gmane.comp.apache.mod-log-sql</ulink>, or via a web browser at <ulink url="http://news.gmane.org/gmane.comp.apache.mod-log-sql">http://news.gmane.org/gmane.comp.apache.mod-log-sql</ulink>.</para> | ||
107 | </sect2> | ||
104 | </sect1> | 108 | </sect1> |
105 | <sect1> | 109 | <sect1> |
106 | <title>Installation</title> | 110 | <title>Installation</title> |
@@ -1227,7 +1231,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1227 | <para>Who's using mod_log_sql?</para> | 1231 | <para>Who's using mod_log_sql?</para> |
1228 | </question> | 1232 | </question> |
1229 | <answer> | 1233 | <answer> |
1230 | <para>Good question! It would be great to find out! If you are a production-level mod_log_sql user, please contact &MaintainerContact; so that you can be mentioned here.</para> | 1234 | <para>Good question! It would be great to find out! If you are a production-level mod_log_sql user, please contact eddie at &EmailContact; so that you can be mentioned here.</para> |
1231 | </answer> | 1235 | </answer> |
1232 | </qandaentry> | 1236 | </qandaentry> |
1233 | <qandaentry> | 1237 | <qandaentry> |
@@ -1277,7 +1281,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen> | |||
1277 | <para>I have discovered a bug. Who can I contact?</para> | 1281 | <para>I have discovered a bug. Who can I contact?</para> |
1278 | </question> | 1282 | </question> |
1279 | <answer> | 1283 | <answer> |
1280 | <para>Please contact &MaintainerContact;, or post a message to the mod_log_sql mailing list. Your comments, suggestions, bugfixes, bug catches, and usage testimonials are always welcome. As free software, mod_log_sql is intended to be a community effort -- any code contributions or other ideas will be fully and openly credited, of course.</para> | 1284 | <para>Please contact Edward Rudd at &EmailContact;, or post a message to the mod_log_sql <xref endterm="Sect.MailingLists.title" linkend="Sect.MailingLists"/>. Your comments, suggestions, bugfixes, bug catches, and usage testimonials are always welcome. As free software, mod_log_sql is intended to be a community effort -- any code contributions or other ideas will be fully and openly credited, of course.</para> |
1281 | </answer> | 1285 | </answer> |
1282 | </qandaentry> | 1286 | </qandaentry> |
1283 | </qandadiv> | 1287 | </qandadiv> |
@@ -1,3 +1,20 @@ | |||
1 | This document has been superseded by the new documentation in the | 1 | This document has been superseded by the new documentation in the |
2 | Documentation/ directory. There you will find the docs in a variety of | 2 | Documentation/ directory. There you will find the docs in a variety of |
3 | formats, including PostScript, plaintext, and HTML. | 3 | formats, including PostScript, plaintext, and HTML. |
4 | |||
5 | Basic overview is.. | ||
6 | |||
7 | ./configure --with-apxs=/path/to/apxs --enable-ssl | ||
8 | |||
9 | gmake | ||
10 | |||
11 | gmake install | ||
12 | |||
13 | |||
14 | edit httpd.conf and add the following. | ||
15 | |||
16 | LoadModule log_sql_module modules/mod_log_sql.so | ||
17 | LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so | ||
18 | <IfModule mod_ssl.c> | ||
19 | LoadModule log_sql_ssl_module modules/mod_log_sql_ssl.so | ||
20 | </IfModule> | ||
diff --git a/Makefile.in b/Makefile.in index 93acec9..b6391e1 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -31,12 +31,22 @@ mysqlLDADD = @MYSQL_LDFLAGS@ @MYSQL_LIBS@ | |||
31 | mysqlCFLAGS = @MYSQL_CFLAGS@ | 31 | mysqlCFLAGS = @MYSQL_CFLAGS@ |
32 | mysqlNAME = log_sql_mysql | 32 | mysqlNAME = log_sql_mysql |
33 | 33 | ||
34 | pgsqlSOURCES = @PACKAGE_NAME@_pgsql.c | ||
35 | pgsqlTARGET = @PACKAGE_NAME@_pgsql@APXS_EXTENSION@ | ||
36 | pgsqlLDADD = @PGSQL_LDFLAGS@ @PGSQL_LIBS@ | ||
37 | pgsqlCFLAGS = @PGSQL_CFLAGS@ | ||
38 | pgsqlNAME = log_sql_pgsql | ||
39 | |||
40 | TARGETS = $(TARGET) | ||
41 | |||
34 | ifeq (@WANT_SSL_MOD@,1) | 42 | ifeq (@WANT_SSL_MOD@,1) |
35 | TARGETS = $(TARGET) $(mysqlTARGET) $(sslTARGET) | 43 | TARGETS += $(sslTARGET) |
36 | else | ||
37 | TARGETS = $(TARGET) $(mysqlTARGET) | ||
38 | endif | 44 | endif |
39 | 45 | ||
46 | TARGETS += $(mysqlTARGET) | ||
47 | |||
48 | TARGETS += $(pgsqlTARGET) | ||
49 | |||
40 | #Don't modify anything below here | 50 | #Don't modify anything below here |
41 | 51 | ||
42 | PROVIDERS_SUBDIRS = @subdirs@ | 52 | PROVIDERS_SUBDIRS = @subdirs@ |
@@ -85,7 +95,7 @@ TODO: TODO.in | |||
85 | 95 | ||
86 | $(TARGET): $(SOURCES) $(HEADERS) | 96 | $(TARGET): $(SOURCES) $(HEADERS) |
87 | @@APXS_BIN@ -c -o $(TARGET) $(CFLAGS) \ | 97 | @@APXS_BIN@ -c -o $(TARGET) $(CFLAGS) \ |
88 | $(LDADD) @DEFS@ @APACHE_DEFS@ $(SOURCES) | 98 | @DEFS@ @APACHE_DEFS@ $(LDADD) $(SOURCES) |
89 | 99 | ||
90 | $(sslTARGET): $(sslSOURCES) $(HEADERS) | 100 | $(sslTARGET): $(sslSOURCES) $(HEADERS) |
91 | @@APXS_BIN@ -c -o $(sslTARGET) $(sslCFLAGS) $(CFLAGS) \ | 101 | @@APXS_BIN@ -c -o $(sslTARGET) $(sslCFLAGS) $(CFLAGS) \ |
@@ -95,6 +105,10 @@ $(mysqlTARGET): $(mysqlSOURCES) $(HEADERS) | |||
95 | @@APXS_BIN@ -c -o $(mysqlTARGET) $(mysqlCFLAGS) $(CFLAGS) \ | 105 | @@APXS_BIN@ -c -o $(mysqlTARGET) $(mysqlCFLAGS) $(CFLAGS) \ |
96 | @DEFS@ @APACHE_DEFS@ $(mysqlLDADD) $(mysqlSOURCES) | 106 | @DEFS@ @APACHE_DEFS@ $(mysqlLDADD) $(mysqlSOURCES) |
97 | 107 | ||
108 | $(pgsqlTARGET): $(pgsqlSOURCES) $(HEADERS) | ||
109 | @@APXS_BIN@ -c -o $(pgsqlTARGET) $(pgsqlCFLAGS) $(CFLAGS) \ | ||
110 | @DEFS@ @APACHE_DEFS@ $(pgsqlLDADD) $(pgsqlSOURCES) | ||
111 | |||
98 | include: | 112 | include: |
99 | rm -rf include | 113 | rm -rf include |
100 | ln -s @APACHE_INCDIR@ include | 114 | ln -s @APACHE_INCDIR@ include |
@@ -1,16 +1,11 @@ | |||
1 | TODO: | 1 | TODO: |
2 | * Port connection portion to other DBMS? Genericize the module? Start with | 2 | * write alternate DB driver (PostgreSQL, libDBI, mod_*_pool) |
3 | PostgreSQL. (provider mechanism, and libDBI) | 3 | * look at forcing table name to ServerName instead of on of the names in |
4 | * does determining table name in massvirtual mode upon every request | 4 | ServerAlias? |
5 | cause performance degradation? If so fix. No other feasable way to fix this, | ||
6 | unless you cache, but then for large amounts of hosts, this can be a waste. | ||
7 | * LogSQLRotateLogs directive with daily/monthly/weekly/etc. | 5 | * LogSQLRotateLogs directive with daily/monthly/weekly/etc. |
8 | * socket-based middleman daemon with configurable conns, or connect/disconnect. | 6 | * socket-based middleman daemon with configurable conns, or connect/disconnect. |
9 | * DBI connection pool when I switch to DBI. | 7 | * DBI connection pool when I switch to DBI. |
10 | * ignore by cookie | 8 | * ignore by cookie |
11 | * break module into separate code files | ||
12 | SSL already separated. | ||
13 | separate DB implimentation into sub-modules via provider mechanism | ||
14 | * investigate thread safety issues | 9 | * investigate thread safety issues |
15 | Use libmysqlclient_r for threaded MPM (or always?) | 10 | Use libmysqlclient_r for threaded MPM (or always?) |
16 | Add thread locks if using standard mysqlclient | 11 | Add thread locks if using standard mysqlclient |
@@ -20,17 +20,6 @@ | |||
20 | 20 | ||
21 | #include "util_time.h" | 21 | #include "util_time.h" |
22 | 22 | ||
23 | /*static void log_error(char *file, int line, int level, const server_rec *s, const char *fmt, ...) __attribute__ ((format (printf, 5,6))); | ||
24 | static inline void log_error(char *file, int line, int level, const server_rec *s, const char *fmt, ...) | ||
25 | { | ||
26 | static char buff[MAX_STRING_LEN]; | ||
27 | va_list args; | ||
28 | va_start(args, fmt); | ||
29 | apr_vsnprintf(buff,MAX_STRING_LEN, fmt,args); | ||
30 | ap_log_error(file,line,level,0,s,"%s",buff); | ||
31 | va_end(args); | ||
32 | }*/ | ||
33 | |||
34 | #define log_error ap_log_error | 23 | #define log_error ap_log_error |
35 | 24 | ||
36 | #endif /* APACHE20_H */ | 25 | #endif /* APACHE20_H */ |
diff --git a/configure.ac b/configure.ac index c93d224..91f4b81 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -47,6 +47,12 @@ AC_CHECK_HEADERS(limits.h) | |||
47 | 47 | ||
48 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) | 48 | AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) |
49 | 49 | ||
50 | PGSQL_LIBS=-lpq | ||
51 | |||
52 | AC_SUBST(PGSQL_LIBS) | ||
53 | AC_SUBST(PGSQL_LDFLAGS) | ||
54 | AC_SUBST(PGSQL_CFLAGS) | ||
55 | |||
50 | dnl Write config.status and the Makefile | 56 | dnl Write config.status and the Makefile |
51 | 57 | ||
52 | AC_OUTPUT(Makefile | 58 | AC_OUTPUT(Makefile |
diff --git a/functions.h b/functions.h index 6163b21..7281588 100644 --- a/functions.h +++ b/functions.h | |||
@@ -1,4 +1,5 @@ | |||
1 | /* $Id$ */ | 1 | /* $Id$ */ |
2 | |||
2 | /* Begin the individual functions that, given a request r, | 3 | /* Begin the individual functions that, given a request r, |
3 | * extract the needed information from it and return the | 4 | * extract the needed information from it and return the |
4 | * value to the calling entity. | 5 | * value to the calling entity. |
diff --git a/functions20.h b/functions20.h index 42fe664..ee58513 100644 --- a/functions20.h +++ b/functions20.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* $Id$ */ | 1 | /* $Id$ */ |
2 | /* functions */ | 2 | |
3 | static const char *extract_bytes_sent(request_rec *r, char *a) | 3 | static const char *extract_bytes_sent(request_rec *r, char *a) |
4 | { | 4 | { |
5 | if (!r->sent_bodyct || !r->bytes_sent) { | 5 | if (!r->sent_bodyct || !r->bytes_sent) { |
diff --git a/mod_log_sql.c b/mod_log_sql.c index 7c16ab9..83a303a 100644 --- a/mod_log_sql.c +++ b/mod_log_sql.c | |||
@@ -1,4 +1,12 @@ | |||
1 | /* $Id: mod_log_sql.c,v 1.20 2004/03/05 00:30:58 urkle Exp $ */ | 1 | /* $Id$ */ |
2 | |||
3 | #if defined(WITH_APACHE20) | ||
4 | # include "apache20.h" | ||
5 | #elif defined(WITH_APACHE13) | ||
6 | # include "apache13.h" | ||
7 | #else | ||
8 | # error Unsupported Apache version | ||
9 | #endif | ||
2 | 10 | ||
3 | #ifdef HAVE_CONFIG_H | 11 | #ifdef HAVE_CONFIG_H |
4 | /* Undefine these to prevent conflicts between Apache ap_config_auto.h and | 12 | /* Undefine these to prevent conflicts between Apache ap_config_auto.h and |
@@ -13,14 +21,6 @@ | |||
13 | #include "config.h" | 21 | #include "config.h" |
14 | #endif | 22 | #endif |
15 | 23 | ||
16 | #if defined(WITH_APACHE20) | ||
17 | # include "apache20.h" | ||
18 | #elif defined(WITH_APACHE13) | ||
19 | # include "apache13.h" | ||
20 | #else | ||
21 | # error Unsupported Apache version | ||
22 | #endif | ||
23 | |||
24 | #if APR_HAVE_UNISTD_H | 24 | #if APR_HAVE_UNISTD_H |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | #endif | 26 | #endif |
diff --git a/mod_log_sql.prj b/mod_log_sql.prj index e88b2c6..bb04bb2 100644 --- a/mod_log_sql.prj +++ b/mod_log_sql.prj | |||
@@ -66,10 +66,11 @@ module.source.type= | |||
66 | module.source.expanded=1 | 66 | module.source.expanded=1 |
67 | module.source.files=\ | 67 | module.source.files=\ |
68 | mod_log_sql.c\ | 68 | mod_log_sql.c\ |
69 | make_combined_log.pl\ | ||
70 | contrib/mysql_import_combined_log.pl\ | 69 | contrib/mysql_import_combined_log.pl\ |
71 | mod_log_sql_ssl.c\ | 70 | mod_log_sql_ssl.c\ |
72 | mod_log_sql_mysql.c | 71 | mod_log_sql_mysql.c\ |
72 | contrib/make_combined_log.pl\ | ||
73 | mod_log_sql_pgsql.c | ||
73 | 74 | ||
74 | module.pixmap.name=. | 75 | module.pixmap.name=. |
75 | module.pixmap.type= | 76 | module.pixmap.type= |
diff --git a/mod_log_sql_mysql.c b/mod_log_sql_mysql.c index 5a654f3..3749d64 100644 --- a/mod_log_sql_mysql.c +++ b/mod_log_sql_mysql.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* $Id: mod_log_sql_mysql.c,v 1.4 2004/03/05 00:30:58 urkle Exp $ */ | 1 | /* $Id$ */ |
2 | #include "mysql.h" | ||
3 | #include "mysqld_error.h" | ||
4 | 2 | ||
5 | #if defined(WITH_APACHE20) | 3 | #if defined(WITH_APACHE20) |
6 | # include "apache20.h" | 4 | # include "apache20.h" |
@@ -25,6 +23,9 @@ | |||
25 | 23 | ||
26 | #include "mod_log_sql.h" | 24 | #include "mod_log_sql.h" |
27 | 25 | ||
26 | #include "mysql.h" | ||
27 | #include "mysqld_error.h" | ||
28 | |||
28 | /* The enduser won't modify these */ | 29 | /* The enduser won't modify these */ |
29 | #define MYSQL_ERROR(mysql) ((mysql)?(mysql_error(mysql)):"MySQL server has gone away") | 30 | #define MYSQL_ERROR(mysql) ((mysql)?(mysql_error(mysql)):"MySQL server has gone away") |
30 | 31 | ||
diff --git a/mod_log_sql_pgsql.c b/mod_log_sql_pgsql.c index 8fb0f9e..7ac4053 100644 --- a/mod_log_sql_pgsql.c +++ b/mod_log_sql_pgsql.c | |||
@@ -8,6 +8,7 @@ | |||
8 | # error Unsupported Apache version | 8 | # error Unsupported Apache version |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | |||
11 | #ifdef HAVE_CONFIG_H | 12 | #ifdef HAVE_CONFIG_H |
12 | /* Undefine these to prevent conflicts between Apache ap_config_auto.h and | 13 | /* Undefine these to prevent conflicts between Apache ap_config_auto.h and |
13 | * my config.h. Only really needed for Apache < 2.0.48, but it can't hurt. | 14 | * my config.h. Only really needed for Apache < 2.0.48, but it can't hurt. |
@@ -23,6 +24,13 @@ | |||
23 | 24 | ||
24 | #include "mod_log_sql.h" | 25 | #include "mod_log_sql.h" |
25 | 26 | ||
27 | #include "libpq-fe.h" | ||
28 | |||
29 | typedef struct { | ||
30 | PGconn *PG; | ||
31 | char *connectioninfo; | ||
32 | } pg_conn_rec; | ||
33 | |||
26 | /* Connect to the MYSQL database */ | 34 | /* Connect to the MYSQL database */ |
27 | static logsql_opendb_ret log_sql_pgsql_connect(server_rec *s, logsql_dbconnection *db) | 35 | static logsql_opendb_ret log_sql_pgsql_connect(server_rec *s, logsql_dbconnection *db) |
28 | { | 36 | { |
@@ -33,7 +41,7 @@ static logsql_opendb_ret log_sql_pgsql_connect(server_rec *s, logsql_dbconnectio | |||
33 | const char *s_tcpport = apr_table_get(db->parms,"port"); | 41 | const char *s_tcpport = apr_table_get(db->parms,"port"); |
34 | unsigned int tcpport = (s_tcpport)?atoi(s_tcpport):3306; | 42 | unsigned int tcpport = (s_tcpport)?atoi(s_tcpport):3306; |
35 | const char *socketfile = apr_table_get(db->parms,"socketfile"); | 43 | const char *socketfile = apr_table_get(db->parms,"socketfile"); |
36 | MYSQL *dblink = db->handle; | 44 | pg_conn_rec *dblink = db->handle; |
37 | 45 | ||
38 | dblink = mysql_init(dblink); | 46 | dblink = mysql_init(dblink); |
39 | db->handle = (void *)dblink; | 47 | db->handle = (void *)dblink; |
@@ -43,7 +51,7 @@ static logsql_opendb_ret log_sql_pgsql_connect(server_rec *s, logsql_dbconnectio | |||
43 | socketfile = "/var/lib/mysql/mysql.sock"; | 51 | socketfile = "/var/lib/mysql/mysql.sock"; |
44 | } | 52 | } |
45 | 53 | ||
46 | if (mysql_real_connect(dblink, host, user, passwd, database, tcpport, | 54 | if (PQconnectdb(dblink, host, user, passwd, database, tcpport, |
47 | socketfile, 0)) { | 55 | socketfile, 0)) { |
48 | log_error(APLOG_MARK,APLOG_DEBUG,0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'", | 56 | log_error(APLOG_MARK,APLOG_DEBUG,0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'", |
49 | host, tcpport, database, user, socketfile); | 57 | host, tcpport, database, user, socketfile); |
@@ -60,7 +68,7 @@ static logsql_opendb_ret log_sql_pgsql_connect(server_rec *s, logsql_dbconnectio | |||
60 | /* Close the DB link */ | 68 | /* Close the DB link */ |
61 | static void log_sql_pgsql_close(logsql_dbconnection *db) | 69 | static void log_sql_pgsql_close(logsql_dbconnection *db) |
62 | { | 70 | { |
63 | mysql_close((MYSQL *)db->handle); | 71 | PQfinish(((pg_conn_rec *)db->handle)->PG); |
64 | } | 72 | } |
65 | 73 | ||
66 | /* Routine to escape the 'dangerous' characters that would otherwise | 74 | /* Routine to escape the 'dangerous' characters that would otherwise |
@@ -113,7 +121,7 @@ static logsql_query_ret log_sql_pgsql_query(request_rec *r,logsql_dbconnection * | |||
113 | unsigned int real_error = 0; | 121 | unsigned int real_error = 0; |
114 | /*const char *real_error_str = NULL;*/ | 122 | /*const char *real_error_str = NULL;*/ |
115 | 123 | ||
116 | MYSQL *dblink = (MYSQL *)db->handle; | 124 | pg_conn_rec *dblink = db->handle; |
117 | 125 | ||
118 | if (!dblink) { | 126 | if (!dblink) { |
119 | return LOGSQL_QUERY_NOLINK; | 127 | return LOGSQL_QUERY_NOLINK; |
@@ -154,7 +162,7 @@ static logsql_table_ret log_sql_pgsql_create(request_rec *r, logsql_dbconnection | |||
154 | char *create_suffix = NULL; | 162 | char *create_suffix = NULL; |
155 | char *create_sql; | 163 | char *create_sql; |
156 | 164 | ||
157 | MYSQL *dblink = (MYSQL *)db->handle; | 165 | pg_conn_rec *dblink = db->handle; |
158 | 166 | ||
159 | /* if (!global_config.createtables) { | 167 | /* if (!global_config.createtables) { |
160 | return APR_SUCCESS; | 168 | return APR_SUCCESS; |
@@ -230,11 +238,11 @@ static logsql_table_ret log_sql_pgsql_create(request_rec *r, logsql_dbconnection | |||
230 | static char *supported_drivers[] = {"pgsql",NULL}; | 238 | static char *supported_drivers[] = {"pgsql",NULL}; |
231 | static logsql_dbdriver pgsql_driver = { | 239 | static logsql_dbdriver pgsql_driver = { |
232 | supported_drivers, | 240 | supported_drivers, |
233 | log_sql_mysql_connect, /* open DB connection */ | 241 | log_sql_pgsql_connect, /* open DB connection */ |
234 | log_sql_mysql_close, /* close DB connection */ | 242 | log_sql_pgsql_close, /* close DB connection */ |
235 | log_sql_mysql_escape, /* escape query */ | 243 | log_sql_pgsql_escape, /* escape query */ |
236 | log_sql_mysql_query, /* insert query */ | 244 | log_sql_pgsql_query, /* insert query */ |
237 | log_sql_mysql_create /* create table */ | 245 | log_sql_pgsql_create /* create table */ |
238 | }; | 246 | }; |
239 | 247 | ||
240 | LOGSQL_REGISTER(pgsql) { | 248 | LOGSQL_REGISTER(pgsql) { |
diff --git a/mod_log_sql_ssl.c b/mod_log_sql_ssl.c index ca4ced7..8b792db 100644 --- a/mod_log_sql_ssl.c +++ b/mod_log_sql_ssl.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* $Id: mod_log_sql_ssl.c,v 1.7 2004/03/05 00:30:58 urkle Exp $ */ | 1 | /* $Id$ */ |
2 | /* mod_log_sql_ssl */ | ||
3 | 2 | ||
4 | #if defined(WITH_APACHE20) | 3 | #if defined(WITH_APACHE20) |
5 | # include "apache20.h" | 4 | # include "apache20.h" |
@@ -23,6 +22,7 @@ | |||
23 | #endif | 22 | #endif |
24 | 23 | ||
25 | #include "mod_log_sql.h" | 24 | #include "mod_log_sql.h" |
25 | |||
26 | #include "mod_ssl.h" | 26 | #include "mod_ssl.h" |
27 | 27 | ||
28 | #if defined(WITH_APACHE20) | 28 | #if defined(WITH_APACHE20) |