mod_log_sql patch (Robert Schulze <rob at rob-schulze.de>)

mod_log_sql is a module for the apache webserver which enables httpd to put access-logs into a RDBMS like MySQL, PostgreSQL and others.
The homepage of this nice module is located here: http://www.outoforder.cc/projects/apache/mod_log_sql/.

NOTE: some of you readers might smile about logging to a database, but certain environments need this type of logging, especially regarding to locking issues when building a cluster of www-nodes. I've tested the module with ab (aka Apache Bench) and it was possible to issue 700 logged requests per second.

Patchset

These patches I've made just try to strenghten the code, clean it a little and fix one bug which triggered pauseless reconnections to the db machine instead of reusing the connection until the apache-child dies. See the comments in the table below.

I first just wanted to fix that one bug but after looking over the code, I realized that there were many string assignments without allocating space for the char *. So I tried to fix all those (in my mind) mistakes along to some others (string comparison with ==).

Note: I just touched all sources which are needed in general and for MySQL logging. There are - of course - the same mistakes in other parts of the module (PostgreSQL/DBI/mod_log_sql_logio).


Download:

Please remember, that this is a patchset, you have to apply these patches chronologically until the desired patchlevel!

mod_log_sql-1.101-rs-1.patch
  • fixes probs with pauseless reconnects
  • no more string assignments (except in declarations)
  • do_merge_array as a procedure (was on TODO list from author)
  • no "else" after "if(...){return;}"
mod_log_sql-1.101-rs-2.patch
  • some cleanups in mod_log_sql_transaction()
  • some cleanups in log_sql_mysql_escape()
  • some cleanups in log_sql_mysql_create()
mod_log_sql-1.101-rs-3.patch
  • replace mysql_real_escape with a pretty dumb alternative, which in my mind is absolutely sufficient (mysql_real_escape respects charsets, which doesn't make sense regarding to the symbols of an url. If you think I am wrong, please tell me :-)
mod_log_sql-1.101-rs-4.patch
  • fixes string comparisons with ==
  • allocate memory for cls->notes_table_* et al
mod_log_sql-1.101-rs-5.patch
  • makes LogSQLTransferLogTable assignable via notes in the request_rec, so its easy to patch mass-virtualhosting-via-db modules to enable them working with mod_log_sql