summaryrefslogtreecommitdiffstats
path: root/mod_log_sql.c
diff options
context:
space:
mode:
authorGravatar Edward Rudd 2004-06-03 04:32:08 +0000
committerGravatar Edward Rudd 2004-06-03 04:32:08 +0000
commit21122f1bb734aa00fc14564d801ea9dc4804c793 (patch)
tree3d4920b9a47a3528de8c4ac80c402853e9d14719 /mod_log_sql.c
parentf73dc64cd6dba290a7e062520a421de2b02f82a4 (diff)
moved quoting of fields to DB driver
fixed segfault in the mysql escape string function DBi driver working with postgresql.
Diffstat (limited to 'mod_log_sql.c')
-rw-r--r--mod_log_sql.c48
1 files changed, 24 insertions, 24 deletions
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);