[Issues] [mod_log_sql 0000083]: Add backticks to table-names to avoid SQL-errors
issues at outoforder.cc
issues at outoforder.cc
Mon Mar 31 07:14:37 EDT 2008
The following issue has been SUBMITTED.
======================================================================
http://issues.outoforder.cc/view.php?id=83
======================================================================
Reported By: wido
Assigned To:
======================================================================
Project: mod_log_sql
Issue ID: 83
Category: Apache Integration
Reproducibility: always
Severity: major
Priority: normal
Status: new
Apache Version: unspecified
======================================================================
Date Submitted: 03-31-2008 07:14 EDT
Last Modified: 03-31-2008 07:14 EDT
======================================================================
Summary: Add backticks to table-names to avoid SQL-errors
Description:
mod_log_sql does not add backticks (` and `) around table-names when
inserting in the database, this causes SQL-errors on some table names.
For example, this query fails:
insert into lost-tv_nl
(agent,bytes_sent,request_protocol,remote_host,request_method,referer,time_stamp,status,request_duration,request_uri,remote_user,virtual_host)
values ('Mozilla/5.0 (compatible; Yahoo! Slurp;
http://help.yahoo.com/help/us/ysearch/slurp)','9483','HTTP/1.0','74.6.25.114','GET','-','1206722898','200','0','/forum/index.php','-','lost-tv.nl');
On our shared-hosting platform we log to one table per virtualhost. When a
dash (-) exists in the table-name, MySQL crashes.
I modified the source and added backticks around all the inserts, then it
works.
For example, i changed the following in mod_log_sql.c:
note_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val)
values %s"
This fixes my issue, but i think quoting all the names should be even
better.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
03-31-08 07:14 wido New Issue
03-31-08 07:14 wido Apache Version => unspecified
======================================================================
More information about the Issues
mailing list