summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG5
-rw-r--r--Makefile.in3
-rw-r--r--apache13.h1
-rw-r--r--configure.ac10
-rw-r--r--docs/manual.xml23
-rw-r--r--mod_log_sql.c48
-rw-r--r--mod_log_sql.h9
-rw-r--r--mod_log_sql.prj15
-rw-r--r--mod_log_sql_mysql.c14
9 files changed, 91 insertions, 37 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2203a8f..919d2a6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
1?: ?
2* Added DBI support
3* fixed segfault in the mysql driver escape_string function
4* switched escape_string driver function to include the string quotes.
5
11.98: 2004-04-12 61.98: 2004-04-12
2* re-fixed apache.m4 to better detect APR and APU code 7* re-fixed apache.m4 to better detect APR and APU code
3* fixed for win32 compilation under apache 2 8* fixed for win32 compilation under apache 2
diff --git a/Makefile.in b/Makefile.in
index 07278d3..5b4f368 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -130,6 +130,9 @@ $(dbiTARGET): $(dbiSOURCES) $(HEADERS)
130install: $(TARGETS) install-subdirs 130install: $(TARGETS) install-subdirs
131 @@APXS_BIN@ -i $(TARGET); \ 131 @@APXS_BIN@ -i $(TARGET); \
132 @APXS_BIN@ -n $(mysqlNAME) -i $(mysqlTARGET); \ 132 @APXS_BIN@ -n $(mysqlNAME) -i $(mysqlTARGET); \
133 if test @WANT_DBI_MOD@ -eq 1; then \
134 @APXS_BIN@ -n $(dbiNAME) -i $(dbiTARGET); \
135 fi; \
133 if test @WANT_SSL_MOD@ -eq 1; then \ 136 if test @WANT_SSL_MOD@ -eq 1; then \
134 @APXS_BIN@ -n $(sslNAME) -i $(sslTARGET); \ 137 @APXS_BIN@ -n $(sslNAME) -i $(sslTARGET); \
135 fi; \ 138 fi; \
diff --git a/apache13.h b/apache13.h
index ce4ec64..77bf0ce 100644
--- a/apache13.h
+++ b/apache13.h
@@ -54,6 +54,7 @@
54 54
55#define apr_pool_create(a,b) *(a) = ap_make_sub_pool(b) 55#define apr_pool_create(a,b) *(a) = ap_make_sub_pool(b)
56#define apr_pool_destroy ap_destroy_pool 56#define apr_pool_destroy ap_destroy_pool
57#define apr_pool_cleanup_register ap_register_cleanup
57#define apr_palloc ap_palloc 58#define apr_palloc ap_palloc
58#define apr_pcalloc ap_pcalloc 59#define apr_pcalloc ap_pcalloc
59#define apr_pstrdup ap_pstrdup 60#define apr_pstrdup ap_pstrdup
diff --git a/configure.ac b/configure.ac
index 42e2bde..d10ad4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
1dnl Required initializer 1dnl Required initializer
2AC_INIT(mod_log_sql, 1.98) 2AC_INIT(mod_log_sql, 1.99)
3OOO_CONFIG_NICE(config.nice) 3OOO_CONFIG_NICE(config.nice)
4AC_PREREQ(2.53) 4AC_PREREQ(2.53)
5AC_CONFIG_HEADERS(config.h) 5AC_CONFIG_HEADERS(config.h)
@@ -35,7 +35,13 @@ WANT_MYSQL_MOD=1
35AC_SUBST(WANT_MYSQL_MOD) 35AC_SUBST(WANT_MYSQL_MOD)
36WANT_PGSQL_MOD=0 36WANT_PGSQL_MOD=0
37AC_SUBST(WANT_PGSQL_MOD) 37AC_SUBST(WANT_PGSQL_MOD)
38WANT_DBI_MOD=0 38WANT_DBI_MOD=1
39DBI_LDFLAGS=""
40DBI_LIBS="-ldbi"
41DBI_CFLAGS=""
42AC_SUBST(DBI_LDFLAGS)
43AC_SUBST(DBI_LIBS)
44AC_SUBST(DBI_CFLAGS)
39AC_SUBST(WANT_DBI_MOD) 45AC_SUBST(WANT_DBI_MOD)
40 46
41case "$target" in 47case "$target" in
diff --git a/docs/manual.xml b/docs/manual.xml
index 880bf03..267e9e0 100644
--- a/docs/manual.xml
+++ b/docs/manual.xml
@@ -707,6 +707,23 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen>
707 </listitem> 707 </listitem>
708 </varlistentry> 708 </varlistentry>
709 <varlistentry> 709 <varlistentry>
710 <term>LogSQLDisablePreserve</term>
711 <listitem>
712 <cmdsynopsis>
713 <command>LogSQLDisablePreserve</command>
714 <arg choice="req">flag</arg>
715 </cmdsynopsis>
716 <simpara>Example: LogDisablePreserve On</simpara>
717 <simpara>Default: Off</simpara>
718 <simpara>Context; main server config</simpara>
719 <para>This option can be enabled to completely disable the preserve file fail back. This may be useful for servers where the file-system is read-only.</para>
720 <para>If the database is not available those log entries will be lost.</para>
721 <note>
722 <para>This is defined only once in the <filename moreinfo="none">httpd.conf</filename> file.</para>
723 </note>
724 </listitem>
725 </varlistentry>
726 <varlistentry>
710 <term>LogSQLMachineID</term> 727 <term>LogSQLMachineID</term>
711 <listitem> 728 <listitem>
712 <cmdsynopsis sepchar=" "> 729 <cmdsynopsis sepchar=" ">
@@ -1104,7 +1121,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen>
1104 <listitem> 1121 <listitem>
1105 <cmdsynopsis sepchar=" "> 1122 <cmdsynopsis sepchar=" ">
1106 <command moreinfo="none">LogSQLRequestAccept</command> 1123 <command moreinfo="none">LogSQLRequestAccept</command>
1107 <arg choice="req" rep="repeat"><replaceable>hostname</replaceable></arg> 1124 <arg choice="req" rep="repeat"><replaceable>substring</replaceable></arg>
1108 </cmdsynopsis> 1125 </cmdsynopsis>
1109 <simpara>Example: LogSQLRequestAccept .html .php .jpg</simpara> 1126 <simpara>Example: LogSQLRequestAccept .html .php .jpg</simpara>
1110 <simpara>Default: if not specified, all requests are 'accepted'</simpara> 1127 <simpara>Default: if not specified, all requests are 'accepted'</simpara>
@@ -1121,7 +1138,7 @@ where a.id=n.id and a.id='PPIDskBRH30AAGPtAsg';</screen>
1121 <listitem> 1138 <listitem>
1122 <cmdsynopsis sepchar=" "> 1139 <cmdsynopsis sepchar=" ">
1123 <command moreinfo="none">LogSQLRequestIgnore</command> 1140 <command moreinfo="none">LogSQLRequestIgnore</command>
1124 <arg choice="req" rep="repeat"><replaceable>hostname</replaceable></arg> 1141 <arg choice="req" rep="repeat"><replaceable>substring</replaceable></arg>
1125 </cmdsynopsis> 1142 </cmdsynopsis>
1126 <simpara>Example: LogSQLRequestIgnore root.exe cmd.exe default.ida favicon.ico</simpara> 1143 <simpara>Example: LogSQLRequestIgnore root.exe cmd.exe default.ida favicon.ico</simpara>
1127 <simpara>Context: virtual host</simpara> 1144 <simpara>Context: virtual host</simpara>
@@ -1578,7 +1595,7 @@ ErrorLog /var/log/httpd/server-messages </programlisting>
1578 API said: error 2013, Lost connection to MySQL server during query 1595 API said: error 2013, Lost connection to MySQL server during query
1579[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: reconnect successful 1596[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: reconnect successful
1580[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: second attempt successful</screen> 1597[Tue Nov 12 19:04:10 2002] [error] mod_log_sql: second attempt successful</screen>
1581 <para>Reference: <ulink url="http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Gone_away">MySQL documentation</ulink></para> 1598 <para>Reference: <ulink url="http://dev.mysql.com/doc/mysql/en/Gone_away.html">MySQL documentation</ulink></para>
1582 </answer> 1599 </answer>
1583 </qandaentry> 1600 </qandaentry>
1584 <qandaentry> 1601 <qandaentry>
diff --git a/mod_log_sql.c b/mod_log_sql.c
index fc9dcc0..dace2d4 100644
--- a/mod_log_sql.c
+++ b/mod_log_sql.c
@@ -504,6 +504,8 @@ static void log_sql_module_init(server_rec *s, apr_pool_t *p)
504 cls->preserve_file = default_p; 504 cls->preserve_file = default_p;
505 } 505 }
506 } 506 }
507 global_config.db.p = p;
508
507#if defined(WITH_APACHE20) 509#if defined(WITH_APACHE20)
508 return OK; 510 return OK;
509#endif 511#endif
@@ -908,9 +910,7 @@ static int log_sql_transaction(request_rec *orig)
908 fields = apr_pstrcat(r->pool, fields, (i ? "," : ""), 910 fields = apr_pstrcat(r->pool, fields, (i ? "," : ""),
909 item->sql_field_name, NULL); 911 item->sql_field_name, NULL);
910 values = apr_pstrcat(r->pool, values, (i ? "," : ""), 912 values = apr_pstrcat(r->pool, values, (i ? "," : ""),
911 (item->string_contents ? "'" : ""), 913 global_config.driver->escape(formatted_item, r->pool,&global_config.db), NULL);
912 global_config.driver->escape(formatted_item, r->pool,&global_config.db),
913 (item->string_contents ? "'" : ""), NULL);
914 } 914 }
915 915
916 /* Work through the list of notes defined by LogSQLWhichNotes */ 916 /* Work through the list of notes defined by LogSQLWhichNotes */
@@ -923,19 +923,19 @@ static int log_sql_transaction(request_rec *orig)
923 if ((theitem = apr_table_get(r->notes, *ptrptr))) { 923 if ((theitem = apr_table_get(r->notes, *ptrptr))) {
924 itemsets = apr_pstrcat(r->pool, itemsets, 924 itemsets = apr_pstrcat(r->pool, itemsets,
925 (i > 0 ? "," : ""), 925 (i > 0 ? "," : ""),
926 "('", 926 "(",
927 unique_id, 927 unique_id,
928 "','", 928 ",",
929 global_config.driver->escape(*ptrptr, r->pool,&global_config.db), 929 global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
930 "','", 930 ",",
931 global_config.driver->escape(theitem, r->pool,&global_config.db), 931 global_config.driver->escape(theitem, r->pool,&global_config.db),
932 "')", 932 ")",
933 NULL); 933 NULL);
934 i++; 934 i++;
935 } 935 }
936 } 936 }
937 if ( itemsets != "" ) { 937 if ( itemsets != "" ) {
938 note_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", 938 note_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
939 /*global_config.insertdelayed?"delayed":*/"", notes_tablename, itemsets); 939 /*global_config.insertdelayed?"delayed":*/"", notes_tablename, itemsets);
940 940
941 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: note string: %s", note_query); 941 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: note string: %s", note_query);
@@ -951,19 +951,19 @@ static int log_sql_transaction(request_rec *orig)
951 if ((theitem = apr_table_get(r->headers_out, *ptrptr))) { 951 if ((theitem = apr_table_get(r->headers_out, *ptrptr))) {
952 itemsets = apr_pstrcat(r->pool, itemsets, 952 itemsets = apr_pstrcat(r->pool, itemsets,
953 (i > 0 ? "," : ""), 953 (i > 0 ? "," : ""),
954 "('", 954 "(",
955 unique_id, 955 unique_id,
956 "','", 956 ",",
957 global_config.driver->escape(*ptrptr, r->pool,&global_config.db), 957 global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
958 "','", 958 ",",
959 global_config.driver->escape(theitem, r->pool,&global_config.db), 959 global_config.driver->escape(theitem, r->pool,&global_config.db),
960 "')", 960 ")",
961 NULL); 961 NULL);
962 i++; 962 i++;
963 } 963 }
964 } 964 }
965 if ( itemsets != "" ) { 965 if ( itemsets != "" ) {
966 hout_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", 966 hout_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
967 /*global_config.insertdelayed?"delayed":*/"", hout_tablename, itemsets); 967 /*global_config.insertdelayed?"delayed":*/"", hout_tablename, itemsets);
968 968
969 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_out string: %s", hout_query); 969 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_out string: %s", hout_query);
@@ -980,19 +980,19 @@ static int log_sql_transaction(request_rec *orig)
980 if ((theitem = apr_table_get(r->headers_in, *ptrptr))) { 980 if ((theitem = apr_table_get(r->headers_in, *ptrptr))) {
981 itemsets = apr_pstrcat(r->pool, itemsets, 981 itemsets = apr_pstrcat(r->pool, itemsets,
982 (i > 0 ? "," : ""), 982 (i > 0 ? "," : ""),
983 "('", 983 "(",
984 unique_id, 984 unique_id,
985 "','", 985 ",",
986 global_config.driver->escape(*ptrptr, r->pool,&global_config.db), 986 global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
987 "','", 987 ",",
988 global_config.driver->escape(theitem, r->pool,&global_config.db), 988 global_config.driver->escape(theitem, r->pool,&global_config.db),
989 "')", 989 ")",
990 NULL); 990 NULL);
991 i++; 991 i++;
992 } 992 }
993 } 993 }
994 if ( itemsets != "" ) { 994 if ( itemsets != "" ) {
995 hin_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", 995 hin_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
996 /*global_config.insertdelayed?"delayed":*/"", hin_tablename, itemsets); 996 /*global_config.insertdelayed?"delayed":*/"", hin_tablename, itemsets);
997 997
998 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_in string: %s", hin_query); 998 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_in string: %s", hin_query);
@@ -1009,20 +1009,20 @@ static int log_sql_transaction(request_rec *orig)
1009 if ( strncmp((theitem = extract_specific_cookie(r, *ptrptr)), "-", 1) ) { 1009 if ( strncmp((theitem = extract_specific_cookie(r, *ptrptr)), "-", 1) ) {
1010 itemsets = apr_pstrcat(r->pool, itemsets, 1010 itemsets = apr_pstrcat(r->pool, itemsets,
1011 (i > 0 ? "," : ""), 1011 (i > 0 ? "," : ""),
1012 "('", 1012 "(",
1013 unique_id, 1013 unique_id,
1014 "','", 1014 ",",
1015 global_config.driver->escape(*ptrptr, r->pool,&global_config.db), 1015 global_config.driver->escape(*ptrptr, r->pool,&global_config.db),
1016 "','", 1016 ",",
1017 global_config.driver->escape(theitem, r->pool,&global_config.db), 1017 global_config.driver->escape(theitem, r->pool,&global_config.db),
1018 "')", 1018 ")",
1019 NULL); 1019 NULL);
1020 i++; 1020 i++;
1021 } 1021 }
1022 1022
1023 } 1023 }
1024 if ( itemsets != "" ) { 1024 if ( itemsets != "" ) {
1025 cookie_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", 1025 cookie_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s",
1026 /*global_config.insertdelayed?"delayed":*/"", cookie_tablename, itemsets); 1026 /*global_config.insertdelayed?"delayed":*/"", cookie_tablename, itemsets);
1027 1027
1028 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: cookie string: %s", cookie_query); 1028 log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: cookie string: %s", cookie_query);
@@ -1030,7 +1030,7 @@ static int log_sql_transaction(request_rec *orig)
1030 1030
1031 1031
1032 /* Set up the actual INSERT statement */ 1032 /* Set up the actual INSERT statement */
1033 access_query = apr_psprintf(r->pool, "insert %s into `%s` (%s) values (%s)", 1033 access_query = apr_psprintf(r->pool, "insert %s into %s (%s) values (%s)",
1034 /*global_config.insertdelayed?"delayed":*/"", transfer_tablename, fields, values); 1034 /*global_config.insertdelayed?"delayed":*/"", transfer_tablename, fields, values);
1035 1035
1036 log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"mod_log_sql: access string: %s", access_query); 1036 log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"mod_log_sql: access string: %s", access_query);
diff --git a/mod_log_sql.h b/mod_log_sql.h
index 56aa2c3..e708f57 100644
--- a/mod_log_sql.h
+++ b/mod_log_sql.h
@@ -36,6 +36,7 @@ LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p,
36typedef struct { 36typedef struct {
37 int connected; /* Are we connected to the DB */ 37 int connected; /* Are we connected to the DB */
38 void *handle; /* DB specific connection pointer */ 38 void *handle; /* DB specific connection pointer */
39 apr_pool_t *p; /* Pool to allocate handle off of */
39 apr_table_t *parms; /* DB connection parameters */ 40 apr_table_t *parms; /* DB connection parameters */
40} logsql_dbconnection; 41} logsql_dbconnection;
41 42
@@ -79,7 +80,7 @@ typedef enum {
79 80
80typedef struct { 81typedef struct {
81 /* NULL terminated list of drivers strings */ 82 /* NULL terminated list of drivers strings */
82 char **provided_drivers; 83 const char **provided_drivers;
83 /* create a connection to the underlying database layer */ 84 /* create a connection to the underlying database layer */
84 logsql_opendb_ret (*connect)(server_rec *s, logsql_dbconnection *db); 85 logsql_opendb_ret (*connect)(server_rec *s, logsql_dbconnection *db);
85 /* disconnect from the underlying database layer */ 86 /* disconnect from the underlying database layer */
@@ -119,6 +120,12 @@ LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p,
119#endif 120#endif
120 121
121#if defined(WITH_APACHE20) 122#if defined(WITH_APACHE20)
123# define LOGSQL_SHUTDOWN \
124 static
125#endif
126
127
128#if defined(WITH_APACHE20)
122#define LOGSQL_REGISTER_RETURN return OK; 129#define LOGSQL_REGISTER_RETURN return OK;
123#elif defined(WITH_APACHE13) 130#elif defined(WITH_APACHE13)
124#define LOGSQL_REGISTER_RETURN 131#define LOGSQL_REGISTER_RETURN
diff --git a/mod_log_sql.prj b/mod_log_sql.prj
index bb04bb2..df61439 100644
--- a/mod_log_sql.prj
+++ b/mod_log_sql.prj
@@ -49,6 +49,18 @@ project.menu.need.terminal=0
49 49
50project.configure.options= 50project.configure.options=
51anjuta.program.arguments= 51anjuta.program.arguments=
52preferences.indent.automatic=1
53preferences.use.tabs=0
54preferences.indent.opening=0
55preferences.indent.closing=0
56preferences.tabsize=4
57preferences.indent.size=4
58preferences.autoformat.style=Style of Kangleipak
59preferences.autoformat.custom.style= -i8 -sc -bli0 -bl0 -cbi0 -ss
60preferences.autoformat.disable=0
61preferences.debugger.command=gdb
62preferences.ui.designer=glade '$(project.name).glade'
63preferences.help.browser=devhelp -s '$(current.file.selection)'
52 64
53module.include.name=. 65module.include.name=.
54module.include.type= 66module.include.type=
@@ -70,7 +82,8 @@ module.source.files=\
70 mod_log_sql_ssl.c\ 82 mod_log_sql_ssl.c\
71 mod_log_sql_mysql.c\ 83 mod_log_sql_mysql.c\
72 contrib/make_combined_log.pl\ 84 contrib/make_combined_log.pl\
73 mod_log_sql_pgsql.c 85 mod_log_sql_pgsql.c\
86 mod_log_sql_dbi.c
74 87
75module.pixmap.name=. 88module.pixmap.name=.
76module.pixmap.type= 89module.pixmap.type=
diff --git a/mod_log_sql_mysql.c b/mod_log_sql_mysql.c
index e64044e..f058110 100644
--- a/mod_log_sql_mysql.c
+++ b/mod_log_sql_mysql.c
@@ -55,7 +55,7 @@ static logsql_opendb_ret log_sql_mysql_connect(server_rec *s, logsql_dbconnectio
55 host, tcpport, database, user, socketfile); 55 host, tcpport, database, user, socketfile);
56 return LOGSQL_OPENDB_SUCCESS; 56 return LOGSQL_OPENDB_SUCCESS;
57 } else { 57 } else {
58 log_error(APLOG_MARK,APLOG_DEBUG,0, s,"mod_log_sql: database connection error: %s", 58 log_error(APLOG_MARK,APLOG_ERR,0, s,"mod_log_sql: database connection error: %s",
59 MYSQL_ERROR(dblink)); 59 MYSQL_ERROR(dblink));
60 log_error(APLOG_MARK,APLOG_DEBUG, 0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'", 60 log_error(APLOG_MARK,APLOG_DEBUG, 0, s,"HOST: '%s' PORT: '%d' DB: '%s' USER: '%s' SOCKET: '%s'",
61 host, tcpport, database, user, socketfile); 61 host, tcpport, database, user, socketfile);
@@ -85,23 +85,24 @@ static const char *log_sql_mysql_escape(const char *from_str, apr_pool_t *p,
85 /* Pre-allocate a new string that could hold twice the original, which would only 85 /* Pre-allocate a new string that could hold twice the original, which would only
86 * happen if the whole original string was 'dangerous' characters. 86 * happen if the whole original string was 'dangerous' characters.
87 */ 87 */
88 to_str = (char *) apr_palloc(p, length * 2 + 1); 88 to_str = (char *) apr_palloc(p, length * 2 + 3);
89 if (!to_str) { 89 if (!to_str) {
90 return from_str; 90 return from_str;
91 } 91 }
92 92 strcpy(to_str, "'");
93 if (!db->connected) { 93 if (!db->connected) {
94 /* Well, I would have liked to use the current database charset. mysql is 94 /* Well, I would have liked to use the current database charset. mysql is
95 * unavailable, however, so I fall back to the slightly less respectful 95 * unavailable, however, so I fall back to the slightly less respectful
96 * mysql_escape_string() function that uses the default charset. 96 * mysql_escape_string() function that uses the default charset.
97 */ 97 */
98 retval = mysql_escape_string(to_str, from_str, length); 98 retval = mysql_escape_string(to_str+1, from_str, length);
99 } else { 99 } else {
100 /* MySQL is available, so I'll go ahead and respect the current charset when 100 /* MySQL is available, so I'll go ahead and respect the current charset when
101 * I perform the escape. 101 * I perform the escape.
102 */ 102 */
103 retval = mysql_real_escape_string((MYSQL *)db->handle, to_str, from_str, length); 103 retval = mysql_real_escape_string((MYSQL *)db->handle, to_str+1, from_str, length);
104 } 104 }
105 strcat(to_str,"'");
105 106
106 if (retval) 107 if (retval)
107 return to_str; 108 return to_str;
@@ -109,6 +110,7 @@ static const char *log_sql_mysql_escape(const char *from_str, apr_pool_t *p,
109 return from_str; 110 return from_str;
110 } 111 }
111} 112}
113
112#if defined(WIN32) 114#if defined(WIN32)
113#define SIGNAL_GRAB 115#define SIGNAL_GRAB
114#define SIGNAL_RELEASE 116#define SIGNAL_RELEASE
@@ -243,7 +245,7 @@ static logsql_table_ret log_sql_mysql_create(request_rec *r, logsql_dbconnection
243 return LOGSQL_TABLE_SUCCESS; 245 return LOGSQL_TABLE_SUCCESS;
244} 246}
245 247
246static char *supported_drivers[] = {"mysql",NULL}; 248static const char *supported_drivers[] = {"mysql",NULL};
247static logsql_dbdriver mysql_driver = { 249static logsql_dbdriver mysql_driver = {
248 supported_drivers, 250 supported_drivers,
249 log_sql_mysql_connect, /* open DB connection */ 251 log_sql_mysql_connect, /* open DB connection */