1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,71 +0,0 @@ |
1 |
-/* |
|
2 |
- * $Id$ |
|
3 |
- * |
|
4 |
- * Copyright (C) 2001-2003 FhG FOKUS |
|
5 |
- * Copyright (C) 2006-2007 iptelorg GmbH |
|
6 |
- * |
|
7 |
- * This file is part of ser, a free SIP server. |
|
8 |
- * |
|
9 |
- * ser is free software; you can redistribute it and/or modify |
|
10 |
- * it under the terms of the GNU General Public License as published by |
|
11 |
- * the Free Software Foundation; either version 2 of the License, or |
|
12 |
- * (at your option) any later version |
|
13 |
- * |
|
14 |
- * For a license to use the ser software under conditions |
|
15 |
- * other than those described here, or to purchase support for this |
|
16 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
17 |
- * info@iptel.org |
|
18 |
- * |
|
19 |
- * ser is distributed in the hope that it will be useful, |
|
20 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
- * GNU General Public License for more details. |
|
23 |
- * |
|
24 |
- * You should have received a copy of the GNU General Public License |
|
25 |
- * along with this program; if not, write to the Free Software |
|
26 |
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
27 |
- */ |
|
28 |
- |
|
29 |
-#ifndef _DB_CON_H |
|
30 |
-#define _DB_CON_H 1 |
|
31 |
- |
|
32 |
-/** \ingroup DB_API |
|
33 |
- * @{ |
|
34 |
- */ |
|
35 |
- |
|
36 |
-#include "db_gen.h" |
|
37 |
-#include "db_ctx.h" |
|
38 |
-#include "db_uri.h" |
|
39 |
- |
|
40 |
-#ifdef __cplusplus |
|
41 |
-extern "C" { |
|
42 |
-#endif /* __cplusplus */ |
|
43 |
- |
|
44 |
-struct db_con; |
|
45 |
-struct db_ctx; |
|
46 |
- |
|
47 |
-typedef int (db_con_connect_t)(struct db_con* con); |
|
48 |
-typedef void (db_con_disconnect_t)(struct db_con* con); |
|
49 |
- |
|
50 |
- |
|
51 |
-typedef struct db_con { |
|
52 |
- db_gen_t gen; /* Generic part of the structure */ |
|
53 |
- db_con_connect_t* connect; |
|
54 |
- db_con_disconnect_t* disconnect; |
|
55 |
- |
|
56 |
- struct db_ctx* ctx; |
|
57 |
- db_uri_t* uri; |
|
58 |
-} db_con_t; |
|
59 |
- |
|
60 |
-struct db_con* db_con(struct db_ctx* ctx, db_uri_t* uri); |
|
61 |
-void db_con_free(struct db_con* con); |
|
62 |
- |
|
63 |
-#ifdef __cplusplus |
|
64 |
-} |
|
65 |
-#endif /* __cplusplus */ |
|
66 |
- |
|
67 |
-/** @} */ |
|
68 |
- |
|
69 |
-#endif /* _DB_CON_H */ |
|
70 |
- |
|
71 |
- |
... | ... |
@@ -29,6 +29,8 @@ |
29 | 29 |
#ifndef _DB_CON_H |
30 | 30 |
#define _DB_CON_H 1 |
31 | 31 |
|
32 |
+/** \ingroup DB_API @{ */ |
|
33 |
+ |
|
32 | 34 |
#include "db_gen.h" |
33 | 35 |
#include "db_ctx.h" |
34 | 36 |
#include "db_uri.h" |
... | ... |
@@ -60,4 +62,8 @@ void db_con_free(struct db_con* con); |
60 | 62 |
} |
61 | 63 |
#endif /* __cplusplus */ |
62 | 64 |
|
65 |
+/** @} */ |
|
66 |
+ |
|
63 | 67 |
#endif /* _DB_CON_H */ |
68 |
+ |
|
69 |
+ |
... | ... |
@@ -1,7 +1,8 @@ |
1 | 1 |
/* |
2 | 2 |
* $Id$ |
3 | 3 |
* |
4 |
- * Copyright (C) 2001-2003 FhG Fokus |
|
4 |
+ * Copyright (C) 2001-2003 FhG FOKUS |
|
5 |
+ * Copyright (C) 2006-2007 iptelorg GmbH |
|
5 | 6 |
* |
6 | 7 |
* This file is part of ser, a free SIP server. |
7 | 8 |
* |
... | ... |
@@ -25,26 +26,38 @@ |
25 | 26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 27 |
*/ |
27 | 28 |
|
29 |
+#ifndef _DB_CON_H |
|
30 |
+#define _DB_CON_H 1 |
|
28 | 31 |
|
32 |
+#include "db_gen.h" |
|
33 |
+#include "db_ctx.h" |
|
34 |
+#include "db_uri.h" |
|
29 | 35 |
|
30 |
-#ifndef DB_CON_H |
|
31 |
-#define DB_CON_H |
|
36 |
+#ifdef __cplusplus |
|
37 |
+extern "C" { |
|
38 |
+#endif /* __cplusplus */ |
|
32 | 39 |
|
40 |
+struct db_con; |
|
41 |
+struct db_ctx; |
|
42 |
+ |
|
43 |
+typedef int (db_con_connect_t)(struct db_con* con); |
|
44 |
+typedef void (db_con_disconnect_t)(struct db_con* con); |
|
33 | 45 |
|
34 |
-/* |
|
35 |
- * This structure represents a database connection |
|
36 |
- * and pointer to this structure is used as a connection |
|
37 |
- * handle |
|
38 |
- */ |
|
39 |
-typedef struct { |
|
40 |
- const char* table; /* Default table to use */ |
|
41 |
- unsigned long tail; /* Variable length tail |
|
42 |
- * database module specific */ |
|
43 |
-} db_con_t; |
|
44 | 46 |
|
47 |
+typedef struct db_con { |
|
48 |
+ db_gen_t gen; /* Generic part of the structure */ |
|
49 |
+ db_con_connect_t* connect; |
|
50 |
+ db_con_disconnect_t* disconnect; |
|
51 |
+ |
|
52 |
+ struct db_ctx* ctx; |
|
53 |
+ db_uri_t* uri; |
|
54 |
+} db_con_t; |
|
45 | 55 |
|
46 |
-#define CON_TABLE(cn) ((cn)->table) |
|
47 |
-#define CON_TAIL(cn) ((cn)->tail) |
|
56 |
+struct db_con* db_con(struct db_ctx* ctx, db_uri_t* uri); |
|
57 |
+void db_con_free(struct db_con* con); |
|
48 | 58 |
|
59 |
+#ifdef __cplusplus |
|
60 |
+} |
|
61 |
+#endif /* __cplusplus */ |
|
49 | 62 |
|
50 |
-#endif /* DB_CON_H */ |
|
63 |
+#endif /* _DB_CON_H */ |
... | ... |
@@ -38,13 +38,11 @@ |
38 | 38 |
*/ |
39 | 39 |
typedef struct { |
40 | 40 |
char* table; /* Default table to use */ |
41 |
- int connected; /* 1 if database is connected */ |
|
42 |
- unsigned long tail[1]; /* Variable length tail |
|
41 |
+ unsigned long tail; /* Variable length tail |
|
43 | 42 |
* database module specific */ |
44 | 43 |
} db_con_t; |
45 | 44 |
|
46 | 45 |
|
47 |
-#define CON_CONNECTED(cn) ((cn)->connected) |
|
48 | 46 |
#define CON_TABLE(cn) ((cn)->table) |
49 | 47 |
#define CON_TAIL(cn) ((cn)->tail) |
50 | 48 |
|
... | ... |
@@ -39,7 +39,7 @@ |
39 | 39 |
typedef struct { |
40 | 40 |
char* table; /* Default table to use */ |
41 | 41 |
int connected; /* 1 if database is connected */ |
42 |
- unsigned char tail[1]; /* Variable length tail |
|
42 |
+ unsigned long tail[1]; /* Variable length tail |
|
43 | 43 |
* database module specific */ |
44 | 44 |
} db_con_t; |
45 | 45 |
|
... | ... |
@@ -39,7 +39,7 @@ |
39 | 39 |
typedef struct { |
40 | 40 |
char* table; /* Default table to use */ |
41 | 41 |
int connected; /* 1 if database is connected */ |
42 |
- unsigned char tail[0]; /* Variable length tail |
|
42 |
+ unsigned char tail[1]; /* Variable length tail |
|
43 | 43 |
* database module specific */ |
44 | 44 |
} db_con_t; |
45 | 45 |
|
... | ... |
@@ -1,8 +1,32 @@ |
1 | 1 |
/* |
2 | 2 |
* $Id$ |
3 |
+ * |
|
4 |
+ * Copyright (C) 2001-2003 Fhg Fokus |
|
5 |
+ * |
|
6 |
+ * This file is part of ser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * ser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * For a license to use the ser software under conditions |
|
14 |
+ * other than those described here, or to purchase support for this |
|
15 |
+ * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
+ * info@iptel.org |
|
17 |
+ * |
|
18 |
+ * ser is distributed in the hope that it will be useful, |
|
19 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
+ * GNU General Public License for more details. |
|
22 |
+ * |
|
23 |
+ * You should have received a copy of the GNU General Public License |
|
24 |
+ * along with this program; if not, write to the Free Software |
|
25 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
3 | 26 |
*/ |
4 | 27 |
|
5 | 28 |
|
29 |
+ |
|
6 | 30 |
#ifndef DB_CON_H |
7 | 31 |
#define DB_CON_H |
8 | 32 |
|
... | ... |
@@ -13,22 +13,19 @@ |
13 | 13 |
* handle |
14 | 14 |
*/ |
15 | 15 |
typedef struct { |
16 |
- char* table; /* Default table to use */ |
|
17 |
- void* con; /* Mysql Connection */ |
|
18 |
- void* res; /* Result of previous operation */ |
|
19 |
- void* row; /* Actual row in the result */ |
|
20 |
- int connected; |
|
16 |
+ char* table; /* Default table to use */ |
|
17 |
+ int connected; /* 1 if database is connected */ |
|
18 |
+ unsigned char tail[0]; /* Variable length tail |
|
19 |
+ * database module specific */ |
|
21 | 20 |
} db_con_t; |
22 | 21 |
|
23 | 22 |
|
24 | 23 |
#define CON_CONNECTED(cn) ((cn)->connected) |
25 | 24 |
#define CON_TABLE(cn) ((cn)->table) |
26 |
-#define CON_CONNECTION(cn) ((cn)->con) |
|
27 |
-#define CON_RESULT(cn) ((cn)->res) |
|
28 |
-#define CON_ROW(cn) ((cn)->row) |
|
25 |
+#define CON_TAIL(cn) ((cn)->tail) |
|
29 | 26 |
|
30 | 27 |
|
31 | 28 |
int use_table(db_con_t* _h, const char* _t); |
32 | 29 |
|
33 | 30 |
|
34 |
-#endif |
|
31 |
+#endif /* DB_CON_H */ |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ */ |
|
4 |
+ |
|
5 |
+ |
|
6 |
+#ifndef DB_CON_H |
|
7 |
+#define DB_CON_H |
|
8 |
+ |
|
9 |
+ |
|
10 |
+/* |
|
11 |
+ * This structure represents a database connection |
|
12 |
+ * and pointer to this structure is used as a connection |
|
13 |
+ * handle |
|
14 |
+ */ |
|
15 |
+typedef struct { |
|
16 |
+ char* table; /* Default table to use */ |
|
17 |
+ void* con; /* Mysql Connection */ |
|
18 |
+ void* res; /* Result of previous operation */ |
|
19 |
+ void* row; /* Actual row in the result */ |
|
20 |
+ int connected; |
|
21 |
+} db_con_t; |
|
22 |
+ |
|
23 |
+ |
|
24 |
+#define CON_CONNECTED(cn) ((cn)->connected) |
|
25 |
+#define CON_TABLE(cn) ((cn)->table) |
|
26 |
+#define CON_CONNECTION(cn) ((cn)->con) |
|
27 |
+#define CON_RESULT(cn) ((cn)->res) |
|
28 |
+#define CON_ROW(cn) ((cn)->row) |
|
29 |
+ |
|
30 |
+ |
|
31 |
+int use_table(db_con_t* _h, const char* _t); |
|
32 |
+ |
|
33 |
+ |
|
34 |
+#endif |