Browse code

db_mysql: remove old module name prefix from several log statements, already added from core

Henning Westerholt authored on 21/01/2019 22:25:02
Showing 1 changed files
... ...
@@ -37,7 +37,7 @@ void my_res_free(db_res_t* res, struct my_res* payload)
37 37
 	mcmd = DB_GET_PAYLOAD(res->cmd);
38 38
 
39 39
 	if (mcmd->st && mysql_stmt_free_result(mcmd->st)) {
40
-		ERR("mysql: Error while freeing MySQL result: %d, %s\n",
40
+		ERR("Error while freeing MySQL result: %d, %s\n",
41 41
 			mysql_stmt_errno(mcmd->st), mysql_stmt_error(mcmd->st));
42 42
 	}
43 43
 
Browse code

db_mysql: use generic PKG_MEM_ERROR, SHM_ERROR and SYS_MEM_ERROR helper defines

Henning Westerholt authored on 21/01/2019 22:17:21
Showing 1 changed files
... ...
@@ -57,7 +57,7 @@ int my_res(db_res_t* res)
57 57
 
58 58
 	mr = (struct my_res*)pkg_malloc(sizeof(struct my_res));
59 59
 	if (mr == NULL) {
60
-		ERR("mysql: No memory left\n");
60
+		PKG_MEM_ERROR;
61 61
 		return -1;
62 62
 	}
63 63
 	if (db_drv_init(&mr->gen, my_res_free) < 0) goto error;
Browse code

db_mysql: coherent indentation and whitespacing

Daniel-Constantin Mierla authored on 09/11/2017 06:03:02
Showing 1 changed files
... ...
@@ -1,4 +1,4 @@
1
-/* 
1
+/*
2 2
  * Copyright (C) 2001-2003 FhG Fokus
3 3
  * Copyright (C) 2006-2007 iptelorg GmbH
4 4
  *
... ...
@@ -14,8 +14,8 @@
14 14
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 15
  * GNU General Public License for more details.
16 16
  *
17
- * You should have received a copy of the GNU General Public License 
18
- * along with this program; if not, write to the Free Software 
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20 20
  */
21 21
 
... ...
@@ -37,7 +37,7 @@ void my_res_free(db_res_t* res, struct my_res* payload)
37 37
 	mcmd = DB_GET_PAYLOAD(res->cmd);
38 38
 
39 39
 	if (mcmd->st && mysql_stmt_free_result(mcmd->st)) {
40
-		ERR("mysql: Error while freeing MySQL result: %d, %s\n", 
40
+		ERR("mysql: Error while freeing MySQL result: %d, %s\n",
41 41
 			mysql_stmt_errno(mcmd->st), mysql_stmt_error(mcmd->st));
42 42
 	}
43 43
 
... ...
@@ -63,8 +63,8 @@ int my_res(db_res_t* res)
63 63
 	if (db_drv_init(&mr->gen, my_res_free) < 0) goto error;
64 64
 	DB_SET_PAYLOAD(res, mr);
65 65
 	return 0;
66
-	
67
- error:
66
+
67
+error:
68 68
 	if (mr) {
69 69
 		db_drv_free(&mr->gen);
70 70
 		pkg_free(mr);
Browse code

core, lib, modules: updated include paths for header files

Daniel-Constantin Mierla authored on 07/12/2016 11:07:22
Showing 1 changed files
... ...
@@ -23,8 +23,8 @@
23 23
 
24 24
 #include "my_cmd.h"
25 25
 
26
-#include "../../mem/mem.h"
27
-#include "../../dprint.h"
26
+#include "../../core/mem/mem.h"
27
+#include "../../core/dprint.h"
28 28
 #include "../../lib/srdb2/db_gen.h"
29 29
 
30 30
 #include <mysql.h>
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,73 @@
1
+/* 
2
+ * Copyright (C) 2001-2003 FhG Fokus
3
+ * Copyright (C) 2006-2007 iptelorg GmbH
4
+ *
5
+ * This file is part of Kamailio, a free SIP server.
6
+ *
7
+ * Kamailio is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version
11
+ *
12
+ * Kamailio is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License 
18
+ * along with this program; if not, write to the Free Software 
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ */
21
+
22
+#include "my_res.h"
23
+
24
+#include "my_cmd.h"
25
+
26
+#include "../../mem/mem.h"
27
+#include "../../dprint.h"
28
+#include "../../lib/srdb2/db_gen.h"
29
+
30
+#include <mysql.h>
31
+
32
+
33
+void my_res_free(db_res_t* res, struct my_res* payload)
34
+{
35
+	struct my_cmd* mcmd;
36
+
37
+	mcmd = DB_GET_PAYLOAD(res->cmd);
38
+
39
+	if (mcmd->st && mysql_stmt_free_result(mcmd->st)) {
40
+		ERR("mysql: Error while freeing MySQL result: %d, %s\n", 
41
+			mysql_stmt_errno(mcmd->st), mysql_stmt_error(mcmd->st));
42
+	}
43
+
44
+	db_drv_free(&payload->gen);
45
+	pkg_free(payload);
46
+}
47
+
48
+
49
+/*
50
+ * Attach a mysql specific structure to db_res, this structure contains a pointer
51
+ * to my_res_free which releases the mysql result stored in the mysql statement
52
+ * and if there is a cursor open in the statement then it will be closed as well
53
+ */
54
+int my_res(db_res_t* res)
55
+{
56
+	struct my_res* mr;
57
+
58
+	mr = (struct my_res*)pkg_malloc(sizeof(struct my_res));
59
+	if (mr == NULL) {
60
+		ERR("mysql: No memory left\n");
61
+		return -1;
62
+	}
63
+	if (db_drv_init(&mr->gen, my_res_free) < 0) goto error;
64
+	DB_SET_PAYLOAD(res, mr);
65
+	return 0;
66
+	
67
+ error:
68
+	if (mr) {
69
+		db_drv_free(&mr->gen);
70
+		pkg_free(mr);
71
+	}
72
+	return -1;
73
+}