OSDN Git Service

* updated changelog
[modchxj/mod_chxj.git] / include / chxj_mysql.h
1 /*
2  * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifdef USE_MYSQL_COOKIE
18 #ifndef __CHXJ_MYSQL_H__
19 #define __CHXJ_MYSQL_H__
20
21 #include <mysql.h>
22 #include "mod_chxj.h"
23 #include "apr.h"
24
25
26 typedef struct {
27   char *host;
28   int  port;
29   char *database;
30   char *username;
31   char *password;
32   char *tablename;
33   int  keep_alive;
34   char *socket_path;
35   char *charset;
36 } mysql_t;
37
38 #define DEFAULT_MYSQL_HOST "localhost"
39 #define DEFAULT_MYSQL_CHARSET "utf8"
40
41 extern int chxj_open_mysql_handle(request_rec *r, mod_chxj_config *m);
42 extern void chxj_close_mysql_handle();
43 extern int chxj_mysql_exist_cookie_table(request_rec *r, mod_chxj_config *m);
44 extern int chxj_mysql_create_cookie_table(request_rec *r, mod_chxj_config *m);
45 extern char *chxj_mysql_get_cookie_from_cookie_id(request_rec *r, mod_chxj_config *m, const char *cookie_id);
46 extern int chxj_mysql_insert_or_update_cookie(request_rec *r, mod_chxj_config *m, const char *cookie_id, const char *data);
47 extern int chxj_mysql_rollback(request_rec *r, mod_chxj_config *m);
48 extern char *chxj_mysql_load_cookie(request_rec *r, mod_chxj_config *m, const char *cookie_id);
49 extern int chxj_mysql_delete_cookie(request_rec *r, mod_chxj_config *m, const char *cookie_id);
50
51 /* expire table */
52 extern int chxj_mysql_create_cookie_expire_table(request_rec *r, mod_chxj_config *m);
53 extern char *chxj_mysql_get_cookie_expire_from_cookie_id(request_rec *r, mod_chxj_config *m, const char *cookie_id);
54 extern int chxj_mysql_insert_or_update_cookie_expire(request_rec *r, mod_chxj_config *m, const char *cookie_id);
55 extern char *chxj_mysql_load_cookie_expire(request_rec *r, mod_chxj_config *m, const char *cookie_id);
56 extern int chxj_mysql_delete_cookie_expire(request_rec *r, mod_chxj_config *m, const char *cookie_id);
57 extern int chxj_mysql_exist_cookie_table_expire(request_rec *r, mod_chxj_config *m);
58 extern char *chxj_mysql_get_timeout_localtime(request_rec *r, mod_chxj_config *m);
59 extern int chxj_mysql_delete_expired_cookie(request_rec *r, mod_chxj_config *m);
60
61
62 /* operation for cookie */
63 extern int chxj_save_cookie_mysql(request_rec *r, mod_chxj_config *m, const char *cookie_id, const char *store_string);
64 extern int chxj_update_cookie_mysql(request_rec *r, mod_chxj_config *m, const char *cookie_id, const char *store_string);
65 extern char *chxj_load_cookie_mysql(request_rec *r, mod_chxj_config *m, const char *cookie_id);
66 extern int chxj_delete_cookie_mysql(request_rec *r, mod_chxj_config *m, const char *cookie_id);
67 extern int chxj_save_cookie_expire_mysql(request_rec *r, mod_chxj_config *m, const char *cookie_id);
68 extern int chxj_delete_cookie_expire_mysql(request_rec *r, mod_chxj_config *m, const char *cookie_id);
69 extern int chxj_cookie_expire_gc_mysql(request_rec *r, mod_chxj_config *m);
70
71 extern int chxj_cookie_lock_mysql(request_rec *r,mod_chxj_config *m);
72 extern int chxj_cookie_unlock_mysql(request_rec *r, mod_chxj_config *m);
73 #endif
74 #endif