summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorChristopher Powell <chris@grubbybaby.com>2002-09-04 18:46:00 (GMT)
committer Christopher Powell <chris@grubbybaby.com>2002-09-04 18:46:00 (GMT)
commit78adb60ccfd9497d5fbc899674ab1263609933b6 (patch)
treed2a6b5229b6d83126b94d2d5d3bcaeb39e9694d5
parent80673c37abcedb421c04193f50e0cd53a6ac01c4 (diff)
*** empty log message ***1.17pre2
-rw-r--r--CHANGELOG8
-rw-r--r--Makefile4
-rw-r--r--mod_log_sql.c275
3 files changed, 163 insertions, 124 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 27a4535..1d38ca9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
1$Id: CHANGELOG,v 1.14 2002/06/27 20:09:17 helios Exp $ 1$Id: CHANGELOG,v 1.15 2002/09/04 18:46:00 helios Exp $
2 2
3 3
4TODO: 4TODO:
@@ -14,6 +14,9 @@ TODO:
14* new format char: IP as bigint? 14* new format char: IP as bigint?
15* socket-based middleman daemon with configurable conns? 15* socket-based middleman daemon with configurable conns?
16 16
17* go ahead and allow dashes - quote the table name!
18* maxlength of request field should be longer
19
17 20
18CHANGES: 21CHANGES:
19 22
@@ -57,7 +60,10 @@ CHANGES:
57 everything it was supposed to (preserve entries, etc.) but not notify 60 everything it was supposed to (preserve entries, etc.) but not notify
58 the sysadmin. Added a log message to alert sysadmin if MySQL is 61 the sysadmin. Added a log message to alert sysadmin if MySQL is
59 unreachable at startup. 62 unreachable at startup.
63* New config key 'I' to extract & log unique_id, provided by mod_unique_id.
60* Migrated to the Artistic License (as used by Perl). 64* Migrated to the Artistic License (as used by Perl).
65* Moved table creation into its own callable function
66* Robustifying table creation
61 67
62 68
631.16: 691.16:
diff --git a/Makefile b/Makefile
index 468f6d6..ed31430 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1# $Id: Makefile,v 1.10 2002/05/14 21:47:14 helios Exp $ 1# $Id: Makefile,v 1.11 2002/09/04 18:46:00 helios Exp $
2MLMVERS = 1.17 2MLMVERS = 1.17
3 3
4# Where you unpacked your Apache tarball -- the source. 4# Where you unpacked your Apache tarball -- the source.
5APACHESOURCE = /usr/local/src/apache_1.3.22 5APACHESOURCE = /usr/local/src/apache_1.3.26
6 6
7# Where Apache [got|will get] installed 7# Where Apache [got|will get] installed
8APACHEINST = /usr/local/Apache 8APACHEINST = /usr/local/Apache
diff --git a/mod_log_sql.c b/mod_log_sql.c
index db9b3a3..a0cceb2 100644
--- a/mod_log_sql.c
+++ b/mod_log_sql.c
@@ -1,4 +1,4 @@
1/* $Id: mod_log_sql.c,v 1.15 2002/06/27 20:09:17 helios Exp $ */ 1/* $Id: mod_log_sql.c,v 1.16 2002/09/04 18:46:00 helios Exp $ */
2 2
3/* --------* 3/* --------*
4 * DEFINES * 4 * DEFINES *
@@ -436,16 +436,16 @@ struct log_sql_item_list {
436 } log_sql_item_keys[] = { 436 } log_sql_item_keys[] = {
437 437
438 { 'A', extract_agent, "agent", 1, 1 }, 438 { 'A', extract_agent, "agent", 1, 1 },
439 { 'b', extract_bytes_sent, "bytes_sent", 0, 0 }, 439 { 'b', extract_bytes_sent, "bytes_sent", 0, 0 },
440 { 'c', extract_cookie, "cookie", 0, 1 }, 440 { 'c', extract_cookie, "cookie", 0, 1 },
441 { 'e', extract_env_var, "env_var", 0, 1 }, 441 { 'e', extract_env_var, "env_var", 0, 1 },
442 { 'f', extract_request_file, "request_file", 0, 1 }, 442 { 'f', extract_request_file, "request_file", 0, 1 },
443 { 'H', extract_request_protocol, "request_protocol", 0, 1 }, 443 { 'H', extract_request_protocol, "request_protocol", 0, 1 },
444 { 'h', extract_remote_host, "remote_host", 0, 1 }, 444 { 'h', extract_remote_host, "remote_host", 0, 1 },
445 { 'i', extract_header_in, "header_in", 0, 1 }, 445 { 'i', extract_header_in, "header_in", 0, 1 },
446 { 'I', extract_unique_id, "id", 0, 1 }, 446 { 'I', extract_unique_id, "id", 0, 1 },
447 { 'l', extract_remote_logname, "remote_logname", 0, 1 }, 447 { 'l', extract_remote_logname, "remote_logname", 0, 1 },
448 { 'm', extract_request_method, "request_method", 0, 1 }, 448 { 'm', extract_request_method, "request_method", 0, 1 },
449 { 'n', extract_note, "note", 0, 1 }, 449 { 'n', extract_note, "note", 0, 1 },
450 { 'o', extract_header_out, "header_out", 0, 1 }, 450 { 'o', extract_header_out, "header_out", 0, 1 },
451 { 'P', extract_child_pid, "child_pid", 0, 0 }, 451 { 'P', extract_child_pid, "child_pid", 0, 0 },
@@ -565,21 +565,25 @@ void preserve_entry(request_rec *r, const char *query)
565 else { 565 else {
566 fprintf(fp,"%s;\n", query); 566 fprintf(fp,"%s;\n", query);
567 pfclose(r->pool, fp); 567 pfclose(r->pool, fp);
568 #ifdef DEBUG
569 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: entry preserved in %s", cls->preserve_file);
570 #endif
568 } 571 }
569} 572}
570 573
574
571/*-----------------------------------------------------*/ 575/*-----------------------------------------------------*/
572/* safe_mysql_query: perform a database query with */ 576/* safe_mysql_query: perform a database query with */
573/* a degree of safety and error checking. */ 577/* a degree of safety and error checking. */
574/* */ 578/* */
575/* Parms: request record, SQL insert statement */ 579/* Parms: request record, SQL insert statement */
576/* Returns: 0 (OK) on success */ 580/* Returns: 0 (OK) on success */
577/* -1 if have no log handle */ 581/* 1 if have no log handle */
578/* actual MySQL return code on error */ 582/* actual MySQL return code on error */
579/*-----------------------------------------------------*/ 583/*-----------------------------------------------------*/
580int safe_mysql_query(request_rec *r, const char *query) 584unsigned int safe_mysql_query(request_rec *r, const char *query)
581{ 585{
582 int retval; 586 unsigned int retval;
583 unsigned int real_error; 587 unsigned int real_error;
584 struct timespec delay, remainder; 588 struct timespec delay, remainder;
585 int ret; 589 int ret;
@@ -593,21 +597,20 @@ int safe_mysql_query(request_rec *r, const char *query)
593 if (mysql_log != NULL) 597 if (mysql_log != NULL)
594 retval = mysql_query(mysql_log, query); 598 retval = mysql_query(mysql_log, query);
595 else 599 else
596 return -1; 600 return 1;
597 601
598 /* If we ran the query and it returned an error, try to be graceful. 602 if ( retval != 0 )
599 * (The module thought it had a valid mysql_log connection but the query
600 * might have failed, so we have to be extra-safe and check.)
601 */
602 if ( retval != 0 )
603 { 603 {
604 /* If we ran the query and it returned an error, try to be robust.
605 * (After all, the module thought it had a valid mysql_log connection but the query
606 * could have failed for a number of reasons, so we have to be extra-safe and check.) */
607
604 log_sql_state *cls = get_module_config(r->server->module_config, &mysql_log_module); 608 log_sql_state *cls = get_module_config(r->server->module_config, &mysql_log_module);
605 609
606 real_error = mysql_errno(mysql_log); 610 real_error = mysql_errno(mysql_log); /* What really happened? */
607 611
608 /* Something went wrong, so start by trying to restart the db link. */ 612 /* Something went wrong, so start by trying to restart the db link. */
609 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: first attempt failed, API said: error %d, %s", real_error, MYSQL_ERROR(mysql_log)); 613 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: first attempt failed, API said: error %d, %s", real_error, MYSQL_ERROR(mysql_log));
610
611 mysql_close(mysql_log); 614 mysql_close(mysql_log);
612 mysql_log = NULL; 615 mysql_log = NULL;
613 open_logdb_link(); 616 open_logdb_link();
@@ -616,20 +619,18 @@ int safe_mysql_query(request_rec *r, const char *query)
616 signal(SIGPIPE, handler); 619 signal(SIGPIPE, handler);
617 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: reconnect failed, unable to reach database. SQL logging stopped until child regains a db connection."); 620 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: reconnect failed, unable to reach database. SQL logging stopped until child regains a db connection.");
618 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: log entries are being preserved in %s", cls->preserve_file); 621 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: log entries are being preserved in %s", cls->preserve_file);
619 preserve_entry(r, query); 622 return 1;
620 return retval; 623 } else
621 } else {
622 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: reconnect successful"); 624 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: reconnect successful");
623 }
624 625
625 /* Attempt a single re-try... First sleep for a tiny amount of time. */ 626 /* First sleep for a tiny amount of time. */
626 delay.tv_sec = 0; 627 delay.tv_sec = 0;
627 delay.tv_nsec = 250000000; /* max is 999999999 (nine nines) */ 628 delay.tv_nsec = 250000000; /* max is 999999999 (nine nines) */
628 ret = nanosleep(&delay, &remainder); 629 ret = nanosleep(&delay, &remainder);
629 if (ret && errno != EINTR) 630 if (ret && errno != EINTR)
630 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: nanosleep unsuccessful"); 631 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: nanosleep unsuccessful");
631 632
632 /* Now make our second attempt */ 633 /* Then make our second attempt */
633 retval = mysql_query(mysql_log,query); 634 retval = mysql_query(mysql_log,query);
634 635
635 /* If this one also failed, log that and append to our local offline file */ 636 /* If this one also failed, log that and append to our local offline file */
@@ -637,11 +638,9 @@ int safe_mysql_query(request_rec *r, const char *query)
637 { 638 {
638 real_error = mysql_errno(mysql_log); 639 real_error = mysql_errno(mysql_log);
639 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: second attempt failed, API said: error %d, %s", real_error, MYSQL_ERROR(mysql_log)); 640 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: second attempt failed, API said: error %d, %s", real_error, MYSQL_ERROR(mysql_log));
640 preserve_entry(r, query); 641 retval = real_error;
641 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: entry preserved in %s", cls->preserve_file); 642 } else
642 } else {
643 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: second attempt successful"); 643 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: second attempt successful");
644 }
645 } 644 }
646 645
647 /* Restore SIGPIPE to its original handler function */ 646 /* Restore SIGPIPE to its original handler function */
@@ -650,6 +649,102 @@ int safe_mysql_query(request_rec *r, const char *query)
650 return retval; 649 return retval;
651} 650}
652 651
652/*-----------------------------------------------------*/
653/* safe_create_tables: create SQL table set for the */
654/* virtual server represented by cls. */
655/* */
656/* Parms: virtserver structure, request record */
657/* Returns: 0 on no errors */
658/* mysql error code on failure */
659/*-----------------------------------------------------*/
660int safe_create_tables(log_sql_state *cls, request_rec *r)
661{
662 int retval;
663 unsigned int create_results;
664 char *create_access = NULL;
665 char *create_notes = NULL;
666 char *create_hout = NULL;
667 char *create_hin = NULL;
668
669 char *createprefix = "create table if not exists ";
670 char *access_suffix =
671 " (id char(19),\
672 agent varchar(255),\
673 bytes_sent int unsigned,\
674 child_pid smallint unsigned,\
675 cookie varchar(255),\
676 request_file varchar(255),\
677 referer varchar(255),\
678 remote_host varchar(50),\
679 remote_logname varchar(50),\
680 remote_user varchar(50),\
681 request_duration smallint unsigned,\
682 request_line varchar(255),\
683 request_method varchar(6),\
684 request_protocol varchar(10),\
685 request_time char(28),\
686 request_uri varchar(50),\
687 server_port smallint unsigned,\
688 ssl_cipher varchar(25),\
689 ssl_keysize smallint unsigned,\
690 ssl_maxkeysize smallint unsigned,\
691 status smallint unsigned,\
692 time_stamp int unsigned,\
693 virtual_host varchar(50))";
694
695 char *notes_suffix =
696 " (id char(19),\
697 item varchar(80),\
698 val varchar(80))";
699
700 char *headers_suffix =
701 " (id char(19),\
702 item varchar(80),\
703 val varchar(80))";
704
705 /* Find memory long enough to hold the whole CREATE string + \0 */
706 create_access = ap_pstrcat(r->pool, createprefix, cls->transfer_table_name, access_suffix, NULL);
707 create_notes = ap_pstrcat(r->pool, createprefix, cls->notes_table_name, notes_suffix, NULL);
708 create_hout = ap_pstrcat(r->pool, createprefix, cls->hout_table_name, headers_suffix, NULL);
709 create_hin = ap_pstrcat(r->pool, createprefix, cls->hin_table_name, headers_suffix, NULL);
710
711 #ifdef DEBUG
712 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: create string: %s", create_access);
713 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: create string: %s", create_notes);
714 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: create string: %s", create_hout);
715 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: create string: %s", create_hin);
716 #endif
717
718 /* Assume that things worked unless told otherwise */
719 cls->table_made = 1;
720 retval = 0;
721
722 if ((create_results = safe_mysql_query(r, create_access)) != 0) {
723 cls->table_made = 0;
724 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: failed to create access table");
725 retval = create_results;
726 }
727
728 if ((create_results = safe_mysql_query(r, create_notes)) != 0) {
729 cls->table_made = 0;
730 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: failed to create notes table");
731 retval = create_results;
732 }
733
734 if ((create_results = safe_mysql_query(r, create_hin)) != 0) {
735 cls->table_made = 0;
736 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: failed to create header_out table");
737 retval = create_results;
738 }
739
740 if ((create_results = safe_mysql_query(r, create_hout)) != 0) {
741 cls->table_made = 0;
742 ap_log_error(APLOG_MARK,ERRLEVEL,r->server,"mod_log_sql: failed to create header_in table");
743 retval = create_results;
744 }
745
746 return retval;
747}
653 748
654/* ------------------------------------------------* 749/* ------------------------------------------------*
655 * Command handlers that are called according * 750 * Command handlers that are called according *
@@ -1060,20 +1155,12 @@ int log_sql_transaction(request_rec *orig)
1060 const char *unique_id; 1155 const char *unique_id;
1061 const char *formatted_item; 1156 const char *formatted_item;
1062 int i, j, length; 1157 int i, j, length;
1063 char *create_access = NULL; 1158 int result;
1064 char *create_notes = NULL;
1065 char *create_hout = NULL;
1066 char *create_hin = NULL;
1067 int create_results;
1068 1159
1069 for (r = orig; r->next; r = r->next) { 1160 for (r = orig; r->next; r = r->next) {
1070 continue; 1161 continue;
1071 } 1162 }
1072 1163
1073 #ifdef DEBUG
1074 /*ap_table_do(trace, orig, orig->subprocess_env, NULL);*/
1075 #endif
1076
1077 /* The following is a stolen upsetting mess of pointers, I'm sorry. 1164 /* The following is a stolen upsetting mess of pointers, I'm sorry.
1078 * Anyone with the motiviation and/or the time should feel free 1165 * Anyone with the motiviation and/or the time should feel free
1079 * to make this cleaner. :) */ 1166 * to make this cleaner. :) */
@@ -1228,64 +1315,6 @@ int log_sql_transaction(request_rec *orig)
1228 #endif 1315 #endif
1229 } 1316 }
1230 1317
1231
1232
1233 /* Is this virtual server's table flagged as made? We flag it as such in order
1234 * to avoid extra processing with each request. If it's not flagged as made,
1235 * set up the CREATE string.
1236 */
1237 if ((cls->table_made != 1) && (create_tables != 0)) {
1238 char *createprefix = "create table if not exists ";
1239 char *access_suffix =
1240 " (id char(19),\
1241 agent varchar(255),\
1242 bytes_sent int unsigned,\
1243 child_pid smallint unsigned,\
1244 cookie varchar(255),\
1245 request_file varchar(255),\
1246 referer varchar(255),\
1247 remote_host varchar(50),\
1248 remote_logname varchar(50),\
1249 remote_user varchar(50),\
1250 request_duration smallint unsigned,\
1251 request_line varchar(255),\
1252 request_method varchar(6),\
1253 request_protocol varchar(10),\
1254 request_time char(28),\
1255 request_uri varchar(50),\
1256 server_port smallint unsigned,\
1257 ssl_cipher varchar(25),\
1258 ssl_keysize smallint unsigned,\
1259 ssl_maxkeysize smallint unsigned,\
1260 status smallint unsigned,\
1261 time_stamp int unsigned,\
1262 virtual_host varchar(50))";
1263
1264 char *notes_suffix =
1265 " (id char(19),\
1266 item varchar(80),\
1267 val varchar(80))";
1268
1269 char *headers_suffix =
1270 " (id char(19),\
1271 item varchar(80),\
1272 val varchar(80))";
1273
1274 /* Find memory long enough to hold the whole CREATE string + \0 */
1275 create_access = ap_pstrcat(orig->pool, createprefix, cls->transfer_table_name, access_suffix, NULL);
1276 create_notes = ap_pstrcat(orig->pool, createprefix, cls->notes_table_name, notes_suffix, NULL);
1277 create_hout = ap_pstrcat(orig->pool, createprefix, cls->hout_table_name, headers_suffix, NULL);
1278 create_hin = ap_pstrcat(orig->pool, createprefix, cls->hin_table_name, headers_suffix, NULL);
1279
1280 #ifdef DEBUG
1281 ap_log_error(APLOG_MARK,DEBUGLEVEL,orig->server,"mod_log_sql: create string: %s", create_access);
1282 ap_log_error(APLOG_MARK,DEBUGLEVEL,orig->server,"mod_log_sql: create string: %s", create_notes);
1283 ap_log_error(APLOG_MARK,DEBUGLEVEL,orig->server,"mod_log_sql: create string: %s", create_hout);
1284 ap_log_error(APLOG_MARK,DEBUGLEVEL,orig->server,"mod_log_sql: create string: %s", create_hin);
1285 #endif
1286
1287 }
1288
1289 /* Set up the actual INSERT statement */ 1318 /* Set up the actual INSERT statement */
1290 access_query = ap_pstrcat(r->pool, "insert into ", cls->transfer_table_name, " (", fields, ") values (", values, ")", NULL); 1319 access_query = ap_pstrcat(r->pool, "insert into ", cls->transfer_table_name, " (", fields, ") values (", values, ")", NULL);
1291 1320
@@ -1293,7 +1322,6 @@ int log_sql_transaction(request_rec *orig)
1293 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: access string: %s", access_query); 1322 ap_log_error(APLOG_MARK,DEBUGLEVEL,r->server,"mod_log_sql: access string: %s", access_query);
1294 #endif 1323 #endif
1295 1324
1296
1297 /* How's our mysql link integrity? */ 1325 /* How's our mysql link integrity? */
1298 if (mysql_log == NULL) { 1326 if (mysql_log == NULL) {
1299 1327
@@ -1322,38 +1350,43 @@ int log_sql_transaction(request_rec *orig)
1322 } 1350 }
1323 1351
1324 1352
1325 /* So as of here we have a non-null value of mysql_log. */ 1353 /* ---> So as of here we have a non-null value of mysql_log. <--- */
1354 /* ---> i.e. we have a good MySQL connection. <--- */
1326 1355
1327 1356
1328 /* Make the tables if we're supposed to. */ 1357 /* Make the tables if we're supposed to. */
1329 if ((cls->table_made != 1) && (create_tables != 0)) { 1358 if ((cls->table_made != 1) && (create_tables != 0)) {
1330 1359 result = safe_create_tables(cls, orig);
1331 /* Assume it will be made successfully...*/ 1360 if (result != 0)
1332 cls->table_made = 1; 1361 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: child attempted but failed to create one or more tables for %s", ap_get_server_name(orig));
1333 1362 else
1334 if ((create_results = safe_mysql_query(orig, create_access)) != 0) { 1363 ap_log_error(APLOG_MARK,NOTICELEVEL,orig->server,"mod_log_sql: no problems creating tables for %s", ap_get_server_name(orig));
1335 cls->table_made = 0;
1336 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: failed to create access table, see preserve file");
1337 }
1338
1339 if ((create_results = safe_mysql_query(orig, create_notes)) != 0) {
1340 cls->table_made = 0;
1341 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: failed to create notes table, see preserve file");
1342 }
1343
1344 if ((create_results = safe_mysql_query(orig, create_hin)) != 0) {
1345 cls->table_made = 0;
1346 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: failed to create header_out table, see preserve file");
1347 }
1348
1349 if ((create_results = safe_mysql_query(orig, create_hout)) != 0) {
1350 cls->table_made = 0;
1351 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: failed to create header_in table, see preserve file");
1352 }
1353 } 1364 }
1354 1365
1355 /* Make the access-table insert */ 1366 /* Make the access-table insert */
1356 safe_mysql_query(orig, access_query); 1367 result = safe_mysql_query(orig, access_query);
1368
1369 /* It failed, but NOT because table didn't exist */
1370 if ( (result != 0) && (result != 1146) )
1371 preserve_entry(orig,access_query);
1372
1373 /* It failed because table didn't exist */
1374 if (result == 1146) {
1375 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: hmm, table didn't yet exist; creating");
1376 result = safe_create_tables(cls, orig);
1377 if (result != 0) {
1378 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: child attempted but failed to create one or more tables for %s, preserving query", ap_get_server_name(orig));
1379 preserve_entry(orig,access_query);
1380 } else {
1381 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: table successfully created, query will now be retried");
1382 result = safe_mysql_query(orig, access_query);
1383 if (result != 0 ) {
1384 ap_log_error(APLOG_MARK,ERRLEVEL,orig->server,"mod_log_sql: giving up, preserving query");
1385 preserve_entry(orig,access_query);
1386 return OK;
1387 }
1388 }
1389 }
1357 1390
1358 /* Log the optional notes, headers, etc. */ 1391 /* Log the optional notes, headers, etc. */
1359 if ( note_query != NULL ) 1392 if ( note_query != NULL )