[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 10:31:03 EDT 2008


A NOTE has been added to this issue. 
====================================================================== 
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 10:31 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.
====================================================================== 

---------------------------------------------------------------------- 
 urkle - 03-31-08 10:31  
---------------------------------------------------------------------- 
https://bugs.launchpad.net/ubuntu/+source/libapache-mod-log-sql/+bug/209628 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-31-08 07:14  wido           New Issue                                    
03-31-08 07:14  wido           Apache Version            => unspecified     
03-31-08 10:31  urkle          Note Added: 0000106                          
======================================================================




More information about the Issues mailing list