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
deleted file mode 100644
... ...
@@ -1,73 +0,0 @@
1
-/* 
2
- * MySQL module row related functions
3
- *
4
- * Copyright (C) 2001-2003 FhG Fokus
5
- * Copyright (C) 2008 1&1 Internet AG
6
- *
7
- * This file is part of Kamailio, a free SIP server.
8
- *
9
- * Kamailio 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
- * Kamailio is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License 
20
- * along with this program; if not, write to the Free Software 
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
- */
23
-
24
-/*! \file
25
- *  \brief DB_MYSQL :: Row related functions
26
- *  \ingroup db_mysql
27
- *  Module: \ref db_mysql
28
- */
29
-
30
-#include "../../dprint.h"
31
-#include "../../mem/mem.h"
32
-#include "../../lib/srdb1/db_row.h"
33
-#include "../../lib/srdb1/db_val.h"
34
-#include "km_my_con.h"
35
-#include "km_val.h"
36
-#include "km_row.h"
37
-#include "km_res.h"
38
-
39
-/*!
40
- * \brief Convert a row from result into DB API representation
41
- * \param _h database connection
42
- * \param _res database result in the DB API representation
43
- * \param _r database result row
44
- * \return 0 on success, -1 on failure
45
- */
46
-int db_mysql_convert_row(const db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
47
-{
48
-	unsigned long* lengths;
49
-	int i;
50
-
51
-	if ((!_h) || (!_res) || (!_r)) {
52
-		LM_ERR("invalid parameter value\n");
53
-		return -1;
54
-	}
55
-
56
-	if (db_allocate_row(_res, _r) != 0) {
57
-		LM_ERR("could not allocate row");
58
-		return -2;
59
-	}
60
-	
61
-	lengths = mysql_fetch_lengths(RES_RESULT(_res));
62
-
63
-	for(i = 0; i < RES_COL_N(_res); i++) {
64
-		if (db_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
65
-			    ((MYSQL_ROW)RES_ROW(_res))[i], lengths[i], 0) < 0) {
66
-			LM_ERR("failed to convert value\n");
67
-			LM_DBG("free row at %p\n", _r);
68
-			db_free_row(_r);
69
-			return -3;
70
-		}
71
-	}
72
-	return 0;
73
-}
Browse code

db_mysql: Remove SVN ID's, remove history sections

Olle E. Johansson authored on 11/03/2015 15:26:21
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /* 
2
- * $Id$ 
3
- *
4 2
  * MySQL module row related functions
5 3
  *
6 4
  * Copyright (C) 2001-2003 FhG Fokus
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -20,7 +20,7 @@
20 20
  *
21 21
  * You should have received a copy of the GNU General Public License 
22 22
  * along with this program; if not, write to the Free Software 
23
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 24
  */
25 25
 
26 26
 /*! \file
Browse code

db_mysql: fix segfault when recursive queries are made

The MySQL result object (MYSQL_RES) should not be stored within the
srdb1 connection object, but rather within the srdb1 result object.
Otherwise recursive queries overwrite each other's result sets, which
results in segfault.

Richard Fuchs authored on 10/04/2013 13:34:49
Showing 1 changed files
... ...
@@ -36,6 +36,7 @@
36 36
 #include "km_my_con.h"
37 37
 #include "km_val.h"
38 38
 #include "km_row.h"
39
+#include "km_res.h"
39 40
 
40 41
 /*!
41 42
  * \brief Convert a row from result into DB API representation
... ...
@@ -59,11 +60,11 @@ int db_mysql_convert_row(const db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
59 60
 		return -2;
60 61
 	}
61 62
 	
62
-	lengths = mysql_fetch_lengths(CON_RESULT(_h));
63
+	lengths = mysql_fetch_lengths(RES_RESULT(_res));
63 64
 
64 65
 	for(i = 0; i < RES_COL_N(_res); i++) {
65 66
 		if (db_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
66
-			    ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i], 0) < 0) {
67
+			    ((MYSQL_ROW)RES_ROW(_res))[i], lengths[i], 0) < 0) {
67 68
 			LM_ERR("failed to convert value\n");
68 69
 			LM_DBG("free row at %p\n", _r);
69 70
 			db_free_row(_r);
Browse code

db_res renamed to db1_res in files originating from kamailio/db_mysql.

The structure db_res has been renamed in lib/srdb1 to db1_res, thus we need to
change the name of the structure in all files originating from
kamailio/modules/db_mysql (and using lib/srdb1).

Jan Janak authored on 16/02/2009 22:13:16
Showing 1 changed files
... ...
@@ -44,7 +44,7 @@
44 44
  * \param _r database result row
45 45
  * \return 0 on success, -1 on failure
46 46
  */
47
-int db_mysql_convert_row(const db1_con_t* _h, db_res_t* _res, db_row_t* _r)
47
+int db_mysql_convert_row(const db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
48 48
 {
49 49
 	unsigned long* lengths;
50 50
 	int i;
Browse code

db_con renamed to db1_con in files originating from kamailio/db_mysql.

The structure db_con has been renamed in lib/srdb1 to db1_con, thus we
need to change the name of the structure in all files originating from
kamailio/modules/db_mysql (and using lib/srdb1).

Jan Janak authored on 16/02/2009 22:09:32
Showing 1 changed files
... ...
@@ -44,7 +44,7 @@
44 44
  * \param _r database result row
45 45
  * \return 0 on success, -1 on failure
46 46
  */
47
-int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
47
+int db_mysql_convert_row(const db1_con_t* _h, db_res_t* _res, db_row_t* _r)
48 48
 {
49 49
 	unsigned long* lengths;
50 50
 	int i;
Browse code

Integration of both modules, first step.

* Defines protecting header files from double inclusion fixed to match
filenames.
* Linked the module also with srdb1
* Fixed path to header files in lib/srdb1.
* Filenames of local included header files prefixed with km_ to match
their real filenames

Jan Janak authored on 16/02/2009 21:58:33
Showing 1 changed files
... ...
@@ -31,11 +31,11 @@
31 31
 
32 32
 #include "../../dprint.h"
33 33
 #include "../../mem/mem.h"
34
-#include "../../db/db_row.h"
35
-#include "../../db/db_val.h"
36
-#include "my_con.h"
37
-#include "val.h"
38
-#include "row.h"
34
+#include "../../lib/srdb1/db_row.h"
35
+#include "../../lib/srdb1/db_val.h"
36
+#include "km_my_con.h"
37
+#include "km_val.h"
38
+#include "km_row.h"
39 39
 
40 40
 /*!
41 41
  * \brief Convert a row from result into DB API representation
Browse code

- partial revert of commit rev5359 for db_mysql module - generalize db_str2val function in the DB API core, the string copying behaviour can now configured (its done for db_postgres, db_unixodbc, not done for db_mysql like in the 1.3, 1.4 branches) - still TODO: fix NULL case in db_unixodbc, try to fix double copying

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5423 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 05/01/2009 18:29:35
Showing 1 changed files
... ...
@@ -63,7 +63,7 @@ int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
63 63
 
64 64
 	for(i = 0; i < RES_COL_N(_res); i++) {
65 65
 		if (db_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
66
-			    ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i]) < 0) {
66
+			    ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i], 0) < 0) {
67 67
 			LM_ERR("failed to convert value\n");
68 68
 			LM_DBG("free row at %p\n", _r);
69 69
 			db_free_row(_r);
Browse code

- unify common rows and row allocation functionality in the DB API core

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5362 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 15/12/2008 16:33:22
Showing 1 changed files
... ...
@@ -47,26 +47,18 @@
47 47
 int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
48 48
 {
49 49
 	unsigned long* lengths;
50
-	int i, len;
50
+	int i;
51 51
 
52 52
 	if ((!_h) || (!_res) || (!_r)) {
53 53
 		LM_ERR("invalid parameter value\n");
54 54
 		return -1;
55 55
 	}
56 56
 
57
-	len = sizeof(db_val_t) * RES_COL_N(_res);
58
-	ROW_VALUES(_r) = (db_val_t*)pkg_malloc(len);
59
-	if (!ROW_VALUES(_r)) {
60
-		LM_ERR("no private memory left\n");
61
-		return -1;
57
+	if (db_allocate_row(_res, _r) != 0) {
58
+		LM_ERR("could not allocate row");
59
+		return -2;
62 60
 	}
63
-	LM_DBG("allocate %d bytes for row values at %p\n", len,
64
-			ROW_VALUES(_r));
65
-
66
-	memset(ROW_VALUES(_r), 0, len);
67
-	/* Save the number of columns in the ROW structure */
68
-	ROW_N(_r) = RES_COL_N(_res);
69
-
61
+	
70 62
 	lengths = mysql_fetch_lengths(CON_RESULT(_h));
71 63
 
72 64
 	for(i = 0; i < RES_COL_N(_res); i++) {
Browse code

- move db_mysql and db_unixodbc str2val implementation to the DB core, remove the duplicated implementation in the modules (preparation for query copy problem) - introduced a small regression for the unixodbc in the NULL value handling that needs to be fixed

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5322 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 10/12/2008 18:41:09
Showing 1 changed files
... ...
@@ -32,7 +32,7 @@
32 32
 #include "../../dprint.h"
33 33
 #include "../../mem/mem.h"
34 34
 #include "../../db/db_row.h"
35
-#include "../../db/db_ut.h"
35
+#include "../../db/db_val.h"
36 36
 #include "my_con.h"
37 37
 #include "val.h"
38 38
 #include "row.h"
... ...
@@ -70,7 +70,7 @@ int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
70 70
 	lengths = mysql_fetch_lengths(CON_RESULT(_h));
71 71
 
72 72
 	for(i = 0; i < RES_COL_N(_res); i++) {
73
-		if (db_mysql_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
73
+		if (db_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
74 74
 			    ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i]) < 0) {
75 75
 			LM_ERR("failed to convert value\n");
76 76
 			LM_DBG("free row at %p\n", _r);
Browse code

- fix a few errors in doxygen documentation - sync one function definitions variables with declaration

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5254 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 25/11/2008 09:34:15
Showing 1 changed files
... ...
@@ -37,8 +37,12 @@
37 37
 #include "val.h"
38 38
 #include "row.h"
39 39
 
40
-/*! \brief
41
- * Convert a row from result into db API representation
40
+/*!
41
+ * \brief Convert a row from result into DB API representation
42
+ * \param _h database connection
43
+ * \param _res database result in the DB API representation
44
+ * \param _r database result row
45
+ * \return 0 on success, -1 on failure
42 46
  */
43 47
 int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
44 48
 {
Browse code

- change name in copyright headers

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4518 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 28/07/2008 15:39:28
Showing 1 changed files
... ...
@@ -6,14 +6,14 @@
6 6
  * Copyright (C) 2001-2003 FhG Fokus
7 7
  * Copyright (C) 2008 1&1 Internet AG
8 8
  *
9
- * This file is part of openser, a free SIP server.
9
+ * This file is part of Kamailio, a free SIP server.
10 10
  *
11
- * openser is free software; you can redistribute it and/or modify
11
+ * Kamailio is free software; you can redistribute it and/or modify
12 12
  * it under the terms of the GNU General Public License as published by
13 13
  * the Free Software Foundation; either version 2 of the License, or
14 14
  * (at your option) any later version
15 15
  *
16
- * openser is distributed in the hope that it will be useful,
16
+ * Kamailio is distributed in the hope that it will be useful,
17 17
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 18
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 19
  * GNU General Public License for more details.
Browse code

- small doxygen updates (group, syntax), small docs update - patch provided from Olle E. Johansson, closes #2025079

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4505 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 24/07/2008 15:20:11
Showing 1 changed files
... ...
@@ -23,6 +23,11 @@
23 23
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 24
  */
25 25
 
26
+/*! \file
27
+ *  \brief DB_MYSQL :: Row related functions
28
+ *  \ingroup db_mysql
29
+ *  Module: \ref db_mysql
30
+ */
26 31
 
27 32
 #include "../../dprint.h"
28 33
 #include "../../mem/mem.h"
... ...
@@ -32,8 +37,7 @@
32 37
 #include "val.h"
33 38
 #include "row.h"
34 39
 
35
-
36
-/**
40
+/*! \brief
37 41
  * Convert a row from result into db API representation
38 42
  */
39 43
 int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
Browse code

- add a few more missing '\n' to debug messages

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4163 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 13/05/2008 12:00:36
Showing 1 changed files
... ...
@@ -52,7 +52,7 @@ int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
52 52
 		LM_ERR("no private memory left\n");
53 53
 		return -1;
54 54
 	}
55
-	LM_DBG("allocate %d bytes for row values at %p", len,
55
+	LM_DBG("allocate %d bytes for row values at %p\n", len,
56 56
 			ROW_VALUES(_r));
57 57
 
58 58
 	memset(ROW_VALUES(_r), 0, len);
... ...
@@ -65,7 +65,7 @@ int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
65 65
 		if (db_mysql_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
66 66
 			    ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i]) < 0) {
67 67
 			LM_ERR("failed to convert value\n");
68
-			LM_DBG("free row at %pn", _r);
68
+			LM_DBG("free row at %p\n", _r);
69 69
 			db_free_row(_r);
70 70
 			return -3;
71 71
 		}
Browse code

- convert existing documentation to doxygen format - add some comments, some smaller cleanups - small adjustment of the fetch_result function to the postgres one, add one DBG message, renames a parameter

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4124 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 07/05/2008 16:36:48
Showing 1 changed files
... ...
@@ -33,7 +33,7 @@
33 33
 #include "row.h"
34 34
 
35 35
 
36
-/*
36
+/**
37 37
  * Convert a row from result into db API representation
38 38
  */
39 39
 int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
Browse code

- rename database modules to use the 'db_' prefix

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3638 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt authored on 06/02/2008 13:10:03
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,74 @@
1
+/* 
2
+ * $Id$ 
3
+ *
4
+ * MySQL module row related functions
5
+ *
6
+ * Copyright (C) 2001-2003 FhG Fokus
7
+ * Copyright (C) 2008 1&1 Internet AG
8
+ *
9
+ * This file is part of openser, a free SIP server.
10
+ *
11
+ * openser is free software; you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation; either version 2 of the License, or
14
+ * (at your option) any later version
15
+ *
16
+ * openser is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License 
22
+ * along with this program; if not, write to the Free Software 
23
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24
+ */
25
+
26
+
27
+#include "../../dprint.h"
28
+#include "../../mem/mem.h"
29
+#include "../../db/db_row.h"
30
+#include "../../db/db_ut.h"
31
+#include "my_con.h"
32
+#include "val.h"
33
+#include "row.h"
34
+
35
+
36
+/*
37
+ * Convert a row from result into db API representation
38
+ */
39
+int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
40
+{
41
+	unsigned long* lengths;
42
+	int i, len;
43
+
44
+	if ((!_h) || (!_res) || (!_r)) {
45
+		LM_ERR("invalid parameter value\n");
46
+		return -1;
47
+	}
48
+
49
+	len = sizeof(db_val_t) * RES_COL_N(_res);
50
+	ROW_VALUES(_r) = (db_val_t*)pkg_malloc(len);
51
+	if (!ROW_VALUES(_r)) {
52
+		LM_ERR("no private memory left\n");
53
+		return -1;
54
+	}
55
+	LM_DBG("allocate %d bytes for row values at %p", len,
56
+			ROW_VALUES(_r));
57
+
58
+	memset(ROW_VALUES(_r), 0, len);
59
+	/* Save the number of columns in the ROW structure */
60
+	ROW_N(_r) = RES_COL_N(_res);
61
+
62
+	lengths = mysql_fetch_lengths(CON_RESULT(_h));
63
+
64
+	for(i = 0; i < RES_COL_N(_res); i++) {
65
+		if (db_mysql_str2val(RES_TYPES(_res)[i], &(ROW_VALUES(_r)[i]),
66
+			    ((MYSQL_ROW)CON_ROW(_h))[i], lengths[i]) < 0) {
67
+			LM_ERR("failed to convert value\n");
68
+			LM_DBG("free row at %pn", _r);
69
+			db_free_row(_r);
70
+			return -3;
71
+		}
72
+	}
73
+	return 0;
74
+}