summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetrica Manoila <petrica.manoila@continental-corporation.com>2014-08-29 09:43:48 +0200
committerPetrica Manoila <petrica.manoila@continental-corporation.com>2014-08-29 09:55:52 +0200
commita349b1fb4276882566b82d827d9290df3d2f8ad2 (patch)
tree03b96ffd9e3ecd0dd7c662234bf83a4dcc175eff
parent823125348b052fb313a428bdbcd3a2602ed89778 (diff)
downloadpersistence-common-object-a349b1fb4276882566b82d827d9290df3d2f8ad2.tar.gz
PCO Vers. 1.0.1 - Split of the low level database access
Added separate folders (itzam, sqlite, rawdb) under src, for specific database access implementations. Default database : itzam. Use "./configure --with-sqlite" to build using the SQLITE db. Provide implementation in src/sqlite/pers_low_level_db_access.c based on pers_low_level_db_access_if.h Use "./configure --with-rawdb" to build using the RAWDB db. Provide implementation in src/rawdb/pers_low_level_db_access.c based on pers_low_level_db_access_if.h Change-Id: I4c32835fd1863b3d25bc35c54958905e2c535758 Signed-off-by: Petrica Manoila <petrica.manoila@continental-corporation.com>
-rw-r--r--ChangeLog13
-rw-r--r--configure.ac44
-rw-r--r--src/Makefile.am90
-rw-r--r--src/itzam/pers_low_level_db_access.c (renamed from src/pers_low_level_db_access.c)0
-rw-r--r--src/rawdb/pers_low_level_db_access.c1
-rw-r--r--src/sqlite/pers_low_level_db_access.c1
6 files changed, 126 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index e69de29..b666b10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -0,0 +1,13 @@
+persistence-common-object ChangeLog
+===================================
+
+Version 1.0.1 25.08.2014
+------------------------
+
+1. Split of the low level database access.
+ Added separate folders (itzam, sqlite, rawdb) under src, for specific database access implementations.
+ Default database : itzam.
+ Use "./configure --with-sqlite" to build using the SQLITE db. Provide implementation in src/sqlite/pers_low_level_db_access.c
+ based on pers_low_level_db_access_if.h
+ Use "./configure --with-rawdb" to build using the RAWDB db. Provide implementation in src/rawdb/pers_low_level_db_access.c
+ based on pers_low_level_db_access_if.h
diff --git a/configure.ac b/configure.ac
index f9a62e8..e41f59a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@
# Copyright (C) 2012 Continental Automotive Systems, Inc.
#
# Author: Ana.Chisca@continental-corporation.com
+# Petrica.Manoila@continental-corporation.com
#
# Configure template for the persistence-common library
#
@@ -89,8 +90,47 @@ PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.30.0])
PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0])
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.30.0])
PKG_CHECK_MODULES([DLT], [automotive-dlt >= 2.2.0])
-PKG_CHECK_MODULES([ITZAM], [libitzam >= 6.0.4])
-ITZAM_LIBS="-litzam"
+
+dnl *************************************
+dnl *** Database support ***
+dnl *************************************
+
+AC_ARG_WITH([database],
+ AS_HELP_STRING([--with-database=auto|itzam|sqlite|rawdb],[Choose database backend.]),[],[with_database=auto])
+
+dnl ********** ITZAM **********
+AS_IF([test "x$with_database" = "xauto" -o "x$with_database" = "xitzam"],
+ [PKG_CHECK_MODULES(ITZAM, [ libitzam >= 6.0.4 ], HAVE_ITZAM=1, HAVE_ITZAM=0)],
+ HAVE_ITZAM=0)
+AS_IF([test "x$HAVE_ITZAM" = "x1"], with_database=itzam)
+AS_IF([test "x$HAVE_ITZAM" = "x1"], ITZAM_LIBS="-litzam")
+AS_IF([test "x$with_database" = "xitzam" -a "x$HAVE_ITZAM" = "x0"],
+ [AC_MSG_ERROR([*** itzam not found])])
+
+AM_CONDITIONAL([HAVE_ITZAM], [test "x$HAVE_ITZAM" = x1])
+
+dnl ********** SQLITE **********
+AS_IF([test "x$with_database" = "xauto" -o "x$with_database" = "xsqlite"],
+ [PKG_CHECK_MODULES(SQLITE, [sqlite3 >= 3.7.5], HAVE_SQLITE=1, HAVE_SQLITE=0)],
+ HAVE_SQLITE=0)
+AS_IF([test "x$HAVE_SQLITE" = "x1"], with_database=sqlite)
+AS_IF([test "x$with_database" = "xsqlite" -a "x$HAVE_SQLITE" = "x0"],
+ [AC_MSG_ERROR([*** sqlite not found])])
+
+AM_CONDITIONAL([HAVE_SQLITE], [test "x$HAVE_SQLITE" = x1])
+
+dnl ********** RAWDB **********
+AS_IF([test "x$with_database" = "xauto" -o "x$with_database" = "xrawdb"],
+ HAVE_RAWDB=1,
+ HAVE_RAWDB=0)
+AS_IF([test "x$HAVE_RAWDB" = "x1"], with_database=rawdb)
+AS_IF([test "x$with_database" = "xrawdb" -a "x$HAVE_RAWDB" = "x0"],
+ [AC_MSG_ERROR([*** rawdb not found])])
+
+AM_CONDITIONAL([HAVE_RAWDB], [test "x$HAVE_RAWDB" = x1])
+
+AS_IF([test "x$HAVE_ITZAM" != x1 -a "x$HAVE_SQLITE" != x1 -a "x$HAVE_RAWDB" != x1],
+ AC_MSG_ERROR([*** missing database backend]))
dnl *************************************
dnl *** Define extra paths ***
diff --git a/src/Makefile.am b/src/Makefile.am
index c8bf708..c2a7a57 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,6 +3,7 @@
# Copyright (C) 2012 Continental Automotive Systems, Inc.
#
# Author: Ana.Chisca@continental-corporation.com
+# Petrica.Manoila@continental-corporation.com
#
# Makefile template for the persistence common library
#
@@ -16,55 +17,102 @@
ACLOCAL_AMFLAGS=-I m4
+# Build objects into the subdirectory of the build directory corresponding to the subdirectory of the source files
+# to avoid conflicts for pers_low_level_db_access.c files for different databases
+AUTOMAKE_OPTIONS = subdir-objects
+
lib_LTLIBRARIES = libpers_common.la
include_HEADERS= \
- $(top_srcdir)/inc/protected/persComTypes.h \
- $(top_srcdir)/inc/protected/persComDataOrg.h \
- $(top_srcdir)/inc/protected/persComDbAccess.h \
- $(top_srcdir)/inc/protected/persComErrors.h \
- $(top_srcdir)/inc/protected/persComRct.h \
- $(top_srcdir)/inc/protected/persComIpc.h
+ ../inc/protected/persComTypes.h \
+ ../inc/protected/persComDataOrg.h \
+ ../inc/protected/persComDbAccess.h \
+ ../inc/protected/persComErrors.h \
+ ../inc/protected/persComRct.h \
+ ../inc/protected/persComIpc.h
libpers_common_la_CFLAGS = \
- -I $(top_srcdir)/inc/private -I $(top_srcdir)/inc/protected -I $(top_srcdir)/generated\
+ -I ../inc/private -I ../inc/protected -I ../generated\
$(DLT_CFLAGS) \
$(GIO_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
$(GLIB_CFLAGS) \
$(GOBJECT_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(ITZAM_CFLAGS)
+ $(DBUS_CFLAGS)
+
+if HAVE_ITZAM
+libpers_common_la_CFLAGS += \
+ $(ITZAM_CFLAGS)
+endif
+
+if HAVE_SQLITE
+libpers_common_la_CFLAGS += \
+ $(SQLITE_CFLAGS)
+endif
+
+if HAVE_RAWDB
+libpers_common_la_CFLAGS += \
+ $(RAWDB_CFLAGS)
+endif
libpers_common_la_SOURCES = \
- $(top_srcdir)/generated/PasClientNotificationGen.c\
- $(top_srcdir)/src/pers_data_organization.c\
- $(top_srcdir)/src/pers_local_shared_db_access.c\
- $(top_srcdir)/src/pers_low_level_db_access.c\
- $(top_srcdir)/src/pers_resource_config_table.c\
- $(top_srcdir)/src/pers_ipc.c\
- $(top_srcdir)/src/pers_ipc_dbus.c
+ ../generated/PasClientNotificationGen.c\
+ ../src/pers_data_organization.c\
+ ../src/pers_local_shared_db_access.c\
+ ../src/pers_resource_config_table.c\
+ ../src/pers_ipc.c\
+ ../src/pers_ipc_dbus.c
+
+if HAVE_ITZAM
+libpers_common_la_SOURCES += \
+ ../src/itzam/pers_low_level_db_access.c
+endif
+
+if HAVE_SQLITE
+libpers_common_la_SOURCES += \
+ ../src/sqlite/pers_low_level_db_access.c
+endif
+
+if HAVE_RAWDB
+libpers_common_la_SOURCES += \
+ ../src/rawdb/pers_low_level_db_access.c
+endif
libpers_common_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
+
libpers_common_la_LIBADD = \
$(DLT_LIBS) \
$(GIO_LIBS) \
$(GIO_UNIX_LIBS) \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
- $(GOBJECT_LIBS) \
- $(ITZAM_LIBS)
+ $(GOBJECT_LIBS)
+
+if HAVE_ITZAM
+libpers_common_la_LIBADD += \
+ $(ITZAM_LIBS)
+endif
+
+if HAVE_SQLITE
+libpers_common_la_LIBADD += \
+ $(SQLITE_LIBS)
+endif
+
+if HAVE_RAWDB
+libpers_common_la_LIBADD += \
+ $(RAWDB_LIBS)
+endif
-dbuspolicy_DATA = $(top_srcdir)/dbus_config/org.genivi.persistence.admin.conf
+dbuspolicy_DATA = ../dbus_config/org.genivi.persistence.admin.conf
# Export interface description of org.genivi.persistence.admin DBus interface
-dbusinterfaces_DATA = $(top_srcdir)/dbus_specifications/org.genivi.persistence.admin.xml
+dbusinterfaces_DATA = ../dbus_specifications/org.genivi.persistence.admin.xml
EXTRA_DIST = $(dbuspolicy_DATA) \
$(dbusinterfaces_DATA)
# pkgconfig
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = $(top_srcdir)/pkgconfig/libperscommon.pc
+pkgconfig_DATA = ../pkgconfig/libperscommon.pc
diff --git a/src/pers_low_level_db_access.c b/src/itzam/pers_low_level_db_access.c
index 4bdfed0..4bdfed0 100644
--- a/src/pers_low_level_db_access.c
+++ b/src/itzam/pers_low_level_db_access.c
diff --git a/src/rawdb/pers_low_level_db_access.c b/src/rawdb/pers_low_level_db_access.c
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/rawdb/pers_low_level_db_access.c
@@ -0,0 +1 @@
+
diff --git a/src/sqlite/pers_low_level_db_access.c b/src/sqlite/pers_low_level_db_access.c
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/sqlite/pers_low_level_db_access.c
@@ -0,0 +1 @@
+