diff options
Diffstat (limited to 'mod_log_sql.h')
-rw-r--r-- | mod_log_sql.h | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/mod_log_sql.h b/mod_log_sql.h index 1eed9b4..032bd01 100644 --- a/mod_log_sql.h +++ b/mod_log_sql.h | |||
@@ -24,9 +24,10 @@ | |||
24 | #define LOGSQL_DECLARE_DATA __declspec(dllimport) | 24 | #define LOGSQL_DECLARE_DATA __declspec(dllimport) |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | /* Registration function for extract functions */ | ||
28 | |||
27 | typedef const char *logsql_item_func(request_rec *r, char *a); | 29 | typedef const char *logsql_item_func(request_rec *r, char *a); |
28 | 30 | ||
29 | /* Registration Function for extract functions */ | ||
30 | LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p, | 31 | LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p, |
31 | char key, logsql_item_func *func, const char *sql_field_name, | 32 | char key, logsql_item_func *func, const char *sql_field_name, |
32 | int want_orig_default, int string_contents); | 33 | int want_orig_default, int string_contents); |
@@ -73,14 +74,54 @@ typedef enum { | |||
73 | LOGSQL_TABLE_HEADERSIN | LOGSQL_TABLE_HEADERSOUT | LOGSQL_TABLE_COOKIES | 74 | LOGSQL_TABLE_HEADERSIN | LOGSQL_TABLE_HEADERSOUT | LOGSQL_TABLE_COOKIES |
74 | 75 | ||
75 | /* MySQL module calls */ | 76 | /* MySQL module calls */ |
76 | logsql_opendb_ret log_sql_mysql_connect(server_rec *s, logsql_dbconnection *db); | ||
77 | void log_sql_mysql_close(logsql_dbconnection *db); | ||
78 | const char *log_sql_mysql_escape(const char *from_str, apr_pool_t *p, | ||
79 | logsql_dbconnection *db); | ||
80 | logsql_query_ret log_sql_mysql_query(request_rec *r,logsql_dbconnection *db, | ||
81 | const char *query); | ||
82 | logsql_table_ret log_sql_mysql_create(request_rec *r, logsql_dbconnection *db, | ||
83 | logsql_tabletype table_type, const char *table_name); | ||
84 | 77 | ||
78 | /* Registration function for database drivers */ | ||
79 | |||
80 | typedef struct { | ||
81 | /* NULL terminated list of drivers strings */ | ||
82 | char **provided_drivers; | ||
83 | /* create a connection to the underlying database layer */ | ||
84 | logsql_opendb_ret (*connect)(server_rec *s, logsql_dbconnection *db); | ||
85 | /* disconnect from the underlying database layer */ | ||
86 | void (*disconnect)(logsql_dbconnection *db); | ||
87 | /* escape the SQL statement according to database rules */ | ||
88 | const char *(*escape)(const char *from_str, apr_pool_t *p, | ||
89 | logsql_dbconnection *db); | ||
90 | /* insert a SQL query statement */ | ||
91 | logsql_query_ret (*insert)(request_rec *r,logsql_dbconnection *db, | ||
92 | const char *query); | ||
93 | /* create a SQL table named table_name of table_type */ | ||
94 | logsql_table_ret (*create_table)(request_rec *r, logsql_dbconnection *db, | ||
95 | logsql_tabletype table_type, const char *table_name); | ||
96 | } logsql_dbdriver; | ||
97 | |||
98 | LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p, | ||
99 | logsql_dbdriver *driver); | ||
100 | |||
101 | /* Module initialization Macros */ | ||
102 | #if defined(WITH_APACHE20) | ||
103 | # define LOGSQL_REGISTER(driver) \ | ||
104 | static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s); \ | ||
105 | static void register_hooks(apr_pool_t *p) { \ | ||
106 | ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); \ | ||
107 | } \ | ||
108 | \ | ||
109 | module AP_MODULE_DECLARE_DATA log_sql_##driver##_module = { \ | ||
110 | STANDARD20_MODULE_STUFF, \ | ||
111 | NULL, NULL, NULL, NULL, NULL, register_hooks }; \ | ||
112 | static int post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) | ||
113 | #elif defined(WITH_APACHE13) | ||
114 | # define LOGSQL_REGISTER() \ | ||
115 | static void module_init(server_rec *s, apr_pool_t *p); \ | ||
116 | module log_sql_##driver##_module = { \ | ||
117 | STANDARD_MODULE_STUFF, module_init }; | ||
118 | static void module_init(server_rec *s, apr_pool_t *p) | ||
119 | #endif | ||
120 | |||
121 | #if defined(WITH_APACHE20) | ||
122 | #define LOGSQL_REGISTER_RETURN return OK; | ||
123 | #elif defined(WITH_APACHE13) | ||
124 | #define LOGSQL_REGISTER_RETURN | ||
125 | #endif | ||
85 | 126 | ||
86 | #endif /* MOD_LOG_SQL_H */ | 127 | #endif /* MOD_LOG_SQL_H */ |