[SR-Dev] git:janakj/mysql: Integration of both modules, first step.

Jan Janak jan at iptel.org
Tue Feb 17 00:05:41 CET 2009


Module: sip-router
Branch: janakj/mysql
Commit: 961212734a44bb41755c72916b205403d66b4458
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=961212734a44bb41755c72916b205403d66b4458

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at iptel.org>
Date:   Mon Feb 16 22:58:33 2009 +0100

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

---

 modules/db_mysql/Makefile      |    2 +-
 modules/db_mysql/km_Makefile   |   41 ----------------------------------------
 modules/db_mysql/km_db_mysql.c |    6 ++--
 modules/db_mysql/km_db_mysql.h |    6 ++--
 modules/db_mysql/km_dbase.c    |   16 +++++++-------
 modules/db_mysql/km_dbase.h    |   16 +++++++-------
 modules/db_mysql/km_my_con.c   |    4 +-
 modules/db_mysql/km_my_con.h   |   10 ++++----
 modules/db_mysql/km_res.c      |    8 +++---
 modules/db_mysql/km_res.h      |    8 +++---
 modules/db_mysql/km_row.c      |   10 ++++----
 modules/db_mysql/km_row.h      |   10 ++++----
 modules/db_mysql/km_val.c      |    6 ++--
 modules/db_mysql/km_val.h      |    8 +++---
 14 files changed, 55 insertions(+), 96 deletions(-)

diff --git a/modules/db_mysql/Makefile b/modules/db_mysql/Makefile
index 13ac208..c3e3e43 100644
--- a/modules/db_mysql/Makefile
+++ b/modules/db_mysql/Makefile
@@ -20,6 +20,6 @@ LIBS=-L/usr/lib/mysql -L$(LOCALBASE)/lib -L$(LOCALBASE)/lib/mysql \
 		-lmysqlclient -lz
 
 SERLIBPATH=../../lib
-SER_LIBS=$(SERLIBPATH)/srdb2/srdb2
+SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1
 
 include ../../Makefile.modules
diff --git a/modules/db_mysql/km_Makefile b/modules/db_mysql/km_Makefile
deleted file mode 100644
index 3fd0adf..0000000
--- a/modules/db_mysql/km_Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# $Id$
-#
-# WARNING: do not run this directly, it should be run by the master Makefile
-
-include ../../Makefile.defs
-auto_gen=
-NAME=db_mysql.so
-
-# set CROSS_COMPILE to true if you want to skip
-# the autodetection
-# CROSS_COMPILE=true
-
-ifeq ($(CROSS_COMPILE),)
-MYSQLCFG=$(shell which mysql_config)
-endif
-
-ifneq ($(MYSQLCFG),)
-
-	# use autodetection
-	DEFS += $(shell $(MYSQLCFG) --include | sed 's/\(-I.*\)\/mysql/\1/g' )
-	LIBS = $(shell $(MYSQLCFG) --libs)
-
-else
-
-	# use standard know paths
-	# mysql.h locations (freebsd,openbsd  solaris)
-	DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/mysql \
-		-I$(LOCALBASE)/mysql/include/mysql -I$(LOCALBASE)/mysql/include \
-		-I$(SYSBASE)/include/mysql
-
-	# libmysqlclient locations on RH/Suse, Solaris /OpenBSD, FreeBSD
-	# (Debian does the right thing and puts it in /usr/lib)
-	LIBS=-L$(SYSBASE)/lib/mysql -L$(LOCALBASE)/lib -L$(LOCALBASE)/lib/mysql \
-		-L$(LOCALBASE)/mysql/lib/mysql/ \
-		-L$(LOCALBASE)/mysql/lib \
-		-L$(SYSBASE)/lib64/mysql \
-		-lm -lmysqlclient -lz
-
-endif
-
-include ../../Makefile.modules
diff --git a/modules/db_mysql/km_db_mysql.c b/modules/db_mysql/km_db_mysql.c
index d1e9e09..dd2907e 100644
--- a/modules/db_mysql/km_db_mysql.c
+++ b/modules/db_mysql/km_db_mysql.c
@@ -42,9 +42,9 @@
  */
 
 #include "../../sr_module.h"
-#include "../../db/db.h"
-#include "dbase.h"
-#include "db_mysql.h"
+#include "../../lib/srdb1/db.h"
+#include "km_dbase.h"
+#include "km_db_mysql.h"
 
 #include <mysql/mysql.h>
 
diff --git a/modules/db_mysql/km_db_mysql.h b/modules/db_mysql/km_db_mysql.h
index 7b476f8..8512fc2 100644
--- a/modules/db_mysql/km_db_mysql.h
+++ b/modules/db_mysql/km_db_mysql.h
@@ -35,11 +35,11 @@
  */
 
 
-#ifndef DB_MOD_H
-#define DB_MOD_H
+#ifndef KM_DB_MOD_H
+#define KM_DB_MOD_H
 
 extern unsigned int db_mysql_ping_interval;
 extern unsigned int db_mysql_timeout_interval;
 extern unsigned int db_mysql_auto_reconnect;
 
-#endif /* DB_MOD_H */
+#endif /* KM_DB_MOD_H */
diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index ed79a17..e34c240 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -40,14 +40,14 @@
 #include <mysql/mysql_version.h>
 #include "../../mem/mem.h"
 #include "../../dprint.h"
-#include "../../db/db_query.h"
-#include "../../db/db_ut.h"
-#include "val.h"
-#include "my_con.h"
-#include "res.h"
-#include "row.h"
-#include "db_mysql.h"
-#include "dbase.h"
+#include "../../lib/srdb1/db_query.h"
+#include "../../lib/srdb1/db_ut.h"
+#include "km_val.h"
+#include "km_my_con.h"
+#include "km_res.h"
+#include "km_row.h"
+#include "km_db_mysql.h"
+#include "km_dbase.h"
 
 
 /**
diff --git a/modules/db_mysql/km_dbase.h b/modules/db_mysql/km_dbase.h
index 68d47b3..e6bc4ec 100644
--- a/modules/db_mysql/km_dbase.h
+++ b/modules/db_mysql/km_dbase.h
@@ -31,15 +31,15 @@
 
 
 
-#ifndef DBASE_H
-#define DBASE_H
+#ifndef KM_DBASE_H
+#define KM_DBASE_H
 
 
-#include "../../db/db_con.h"
-#include "../../db/db_res.h"
-#include "../../db/db_key.h"
-#include "../../db/db_op.h"
-#include "../../db/db_val.h"
+#include "../../lib/srdb1/db_con.h"
+#include "../../lib/srdb1/db_res.h"
+#include "../../lib/srdb1/db_key.h"
+#include "../../lib/srdb1/db_op.h"
+#include "../../lib/srdb1/db_val.h"
 #include "../../str.h"
 
 /*! \brief
@@ -125,4 +125,4 @@ int db_insert_update(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v,
 int db_mysql_use_table(db_con_t* _h, const str* _t);
 
 
-#endif /* DBASE_H */
+#endif /* KM_DBASE_H */
diff --git a/modules/db_mysql/km_my_con.c b/modules/db_mysql/km_my_con.c
index b5ec56a..b938117 100644
--- a/modules/db_mysql/km_my_con.c
+++ b/modules/db_mysql/km_my_con.c
@@ -28,8 +28,8 @@
  */
 
 
-#include "my_con.h"
-#include "db_mysql.h"
+#include "km_my_con.h"
+#include "km_db_mysql.h"
 #include <mysql/mysql_version.h>
 #include "../../mem/mem.h"
 #include "../../dprint.h"
diff --git a/modules/db_mysql/km_my_con.h b/modules/db_mysql/km_my_con.h
index 75a8e35..2624f34 100644
--- a/modules/db_mysql/km_my_con.h
+++ b/modules/db_mysql/km_my_con.h
@@ -29,11 +29,11 @@
  */
 
 
-#ifndef MY_CON_H
-#define MY_CON_H
+#ifndef KM_MY_CON_H
+#define KM_MY_CON_H
 
-#include "../../db/db_pool.h"
-#include "../../db/db_id.h"
+#include "../../lib/srdb1/db_pool.h"
+#include "../../lib/srdb1/db_id.h"
 
 #include <time.h>
 #include <mysql/mysql.h>
@@ -72,4 +72,4 @@ struct my_con* db_mysql_new_connection(const struct db_id* id);
  */
 void db_mysql_free_connection(struct pool_con* con);
 
-#endif /* MY_CON_H */
+#endif /* KM_MY_CON_H */
diff --git a/modules/db_mysql/km_res.c b/modules/db_mysql/km_res.c
index 5a743f9..3e51c7b 100644
--- a/modules/db_mysql/km_res.c
+++ b/modules/db_mysql/km_res.c
@@ -33,12 +33,12 @@
 
 #include <string.h>
 #include <mysql/mysql.h>
-#include "../../db/db_res.h"
+#include "../../lib/srdb1/db_res.h"
 #include "../../mem/mem.h"
 #include "../../dprint.h"
-#include "row.h"
-#include "my_con.h"
-#include "res.h"
+#include "km_row.h"
+#include "km_my_con.h"
+#include "km_res.h"
 
 
 /*!
diff --git a/modules/db_mysql/km_res.h b/modules/db_mysql/km_res.h
index 4bded19..24f981b 100644
--- a/modules/db_mysql/km_res.h
+++ b/modules/db_mysql/km_res.h
@@ -31,11 +31,11 @@
  */
 
 
-#ifndef RES_H
-#define RES_H
+#ifndef KM_RES_H
+#define KM_RES_H
 
-#include "../../db/db_res.h"
-#include "../../db/db_con.h"
+#include "../../lib/srdb1/db_res.h"
+#include "../../lib/srdb1/db_con.h"
 
 
 /*!
diff --git a/modules/db_mysql/km_row.c b/modules/db_mysql/km_row.c
index b44068a..608cb8c 100644
--- a/modules/db_mysql/km_row.c
+++ b/modules/db_mysql/km_row.c
@@ -31,11 +31,11 @@
 
 #include "../../dprint.h"
 #include "../../mem/mem.h"
-#include "../../db/db_row.h"
-#include "../../db/db_val.h"
-#include "my_con.h"
-#include "val.h"
-#include "row.h"
+#include "../../lib/srdb1/db_row.h"
+#include "../../lib/srdb1/db_val.h"
+#include "km_my_con.h"
+#include "km_val.h"
+#include "km_row.h"
 
 /*!
  * \brief Convert a row from result into DB API representation
diff --git a/modules/db_mysql/km_row.h b/modules/db_mysql/km_row.h
index 068f05e..9bdc7e9 100644
--- a/modules/db_mysql/km_row.h
+++ b/modules/db_mysql/km_row.h
@@ -31,12 +31,12 @@
  */
 
 
-#ifndef ROW_H
-#define ROW_H
+#ifndef KM_ROW_H
+#define KM_ROW_H
 
-#include "../../db/db_con.h"
-#include "../../db/db_res.h"
-#include "../../db/db_row.h"
+#include "../../lib/srdb1/db_con.h"
+#include "../../lib/srdb1/db_res.h"
+#include "../../lib/srdb1/db_row.h"
 
 
 /*!
diff --git a/modules/db_mysql/km_val.c b/modules/db_mysql/km_val.c
index 338e48f..d6167f0 100644
--- a/modules/db_mysql/km_val.c
+++ b/modules/db_mysql/km_val.c
@@ -28,9 +28,9 @@
  */
 
 #include "../../dprint.h"
-#include "../../db/db_ut.h"
-#include "val.h"
-#include "my_con.h"
+#include "../../lib/srdb1/db_ut.h"
+#include "km_val.h"
+#include "km_my_con.h"
 
 
 /*!
diff --git a/modules/db_mysql/km_val.h b/modules/db_mysql/km_val.h
index 1040ea4..449334b 100644
--- a/modules/db_mysql/km_val.h
+++ b/modules/db_mysql/km_val.h
@@ -29,12 +29,12 @@
  */
 
 
-#ifndef VAL_H
-#define VAL_H
+#ifndef KM_VAL_H
+#define KM_VAL_H
 
 #include <mysql/mysql.h>
-#include "../../db/db_val.h"
-#include "../../db/db.h"
+#include "../../lib/srdb1/db_val.h"
+#include "../../lib/srdb1/db.h"
 
 
 /*!




More information about the sr-dev mailing list