diff options
author | Christopher Powell | 2002-04-23 17:26:15 +0000 |
---|---|---|
committer | Christopher Powell | 2002-04-23 17:26:15 +0000 |
commit | 3a3c68117e1fdb7814815568a39b042b92b4df5d (patch) | |
tree | 4f05c605ebafc3811ba748889d3f322b1db8c44a | |
parent | 8e6b94ccc7aeddaf63fa8d1b1bcce7d118f28084 (diff) |
Moved the create_tables flag to the 'main server' and out of virtual-host1.16
space.
-rw-r--r-- | mod_log_sql.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/mod_log_sql.c b/mod_log_sql.c index fc46853..25a5013 100644 --- a/mod_log_sql.c +++ b/mod_log_sql.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: mod_log_sql.c,v 1.10 2002/04/23 03:46:20 helios Exp $ */ | 1 | /* $Id: mod_log_sql.c,v 1.11 2002/04/23 17:26:15 helios Exp $ */ |
2 | 2 | ||
3 | /* --------* | 3 | /* --------* |
4 | * DEFINES * | 4 | * DEFINES * |
@@ -50,6 +50,7 @@ module mysql_log_module; | |||
50 | MYSQL sql_server, *mysql_log = NULL; | 50 | MYSQL sql_server, *mysql_log = NULL; |
51 | 51 | ||
52 | int massvirtual = 0; | 52 | int massvirtual = 0; |
53 | int create_tables = 0; | ||
53 | char *db_name = NULL; | 54 | char *db_name = NULL; |
54 | char *db_host = NULL; | 55 | char *db_host = NULL; |
55 | char *db_user = NULL; | 56 | char *db_user = NULL; |
@@ -65,7 +66,6 @@ typedef const char *(*item_key_func) (request_rec *, char *); | |||
65 | * Each child process has its own segregated copy of this structure. | 66 | * Each child process has its own segregated copy of this structure. |
66 | */ | 67 | */ |
67 | typedef struct { | 68 | typedef struct { |
68 | int create_tables; | ||
69 | int table_made; | 69 | int table_made; |
70 | char *transfer_table_name; | 70 | char *transfer_table_name; |
71 | array_header *referer_ignore_list; | 71 | array_header *referer_ignore_list; |
@@ -609,9 +609,7 @@ const char *set_mysql_massvirtual(cmd_parms *parms, void *dummy, int flag) | |||
609 | 609 | ||
610 | const char *set_log_mysql_create(cmd_parms *parms, void *dummy, int flag) | 610 | const char *set_log_mysql_create(cmd_parms *parms, void *dummy, int flag) |
611 | { | 611 | { |
612 | log_mysql_state *cls = get_module_config(parms->server->module_config, &mysql_log_module); | 612 | create_tables = ( flag ? 1 : 0); |
613 | |||
614 | cls->create_tables = ( flag ? 1 : 0); | ||
615 | return NULL; | 613 | return NULL; |
616 | } | 614 | } |
617 | 615 | ||
@@ -791,7 +789,6 @@ void *log_mysql_make_state(pool *p, server_rec *s) | |||
791 | cls->remhost_ignore_list = make_array(p, 1, sizeof(char *)); | 789 | cls->remhost_ignore_list = make_array(p, 1, sizeof(char *)); |
792 | 790 | ||
793 | cls->table_made = 0; | 791 | cls->table_made = 0; |
794 | cls->create_tables = 0; | ||
795 | 792 | ||
796 | cls->preserve_file = "/tmp/mysql-preserve"; | 793 | cls->preserve_file = "/tmp/mysql-preserve"; |
797 | 794 | ||
@@ -875,7 +872,7 @@ int log_mysql_transaction(request_rec *orig) | |||
875 | * turn on create_tables, which is implied by massvirtual. | 872 | * turn on create_tables, which is implied by massvirtual. |
876 | */ | 873 | */ |
877 | cls->transfer_table_name = tablename; | 874 | cls->transfer_table_name = tablename; |
878 | cls->create_tables = 1; | 875 | create_tables = 1; |
879 | } | 876 | } |
880 | 877 | ||
881 | /* Do we have enough info to log? */ | 878 | /* Do we have enough info to log? */ |
@@ -967,7 +964,7 @@ int log_mysql_transaction(request_rec *orig) | |||
967 | * to avoid extra processing with each request. If it's not flagged as made, | 964 | * to avoid extra processing with each request. If it's not flagged as made, |
968 | * set up the CREATE string. | 965 | * set up the CREATE string. |
969 | */ | 966 | */ |
970 | if ((cls->table_made != 1) && (cls->create_tables != 0)) { | 967 | if ((cls->table_made != 1) && (create_tables != 0)) { |
971 | char *createprefix = "create table if not exists "; | 968 | char *createprefix = "create table if not exists "; |
972 | char *createsuffix = | 969 | char *createsuffix = |
973 | " (agent varchar(255),\ | 970 | " (agent varchar(255),\ |
@@ -1029,7 +1026,7 @@ int log_mysql_transaction(request_rec *orig) | |||
1029 | } | 1026 | } |
1030 | 1027 | ||
1031 | /* Make the table if we're supposed to */ | 1028 | /* Make the table if we're supposed to */ |
1032 | if ((cls->table_made != 1) && (cls->create_tables != 0)) { | 1029 | if ((cls->table_made != 1) && (create_tables != 0)) { |
1033 | mysql_query(mysql_log,createstring); | 1030 | mysql_query(mysql_log,createstring); |
1034 | cls->table_made = 1; | 1031 | cls->table_made = 1; |
1035 | } | 1032 | } |