Re: [gnome-db] Berkeley DB Provider?



On Fri, 2003-11-21 at 22:34, Rodrigo Moya wrote:
> cool! Please go ahead.

So here it is.

Attached is a patch for configure.in and providers/Makefile.in + a
tarball which should be decompressed in the providers directory (not
part of the patch since I don't want to create the bdb directory without
your authorization).

It is an experimental (but working) release, which supports only
sleepycat (db3) implementation.  Currently gda_connection_get_schema
(with GDA_CONNECTION_SCHEMA_TABLES) is used to retrieve the data, as a
single table of pair values (key and data).

The connection string must define FILE, and optionally DATABASE (for
files which contain more than one databases).

TODO:
      * support previous implementation (db1)
      * transactions
      * updatable data models
      * a simple sql dialect (via libgdasql)?
      * ...

I included a small test case for the provider (in
providers/bdb/gda-bdb-test.c).  I plan to include it in the testing
directory asap.

Please tell me what you think ;-)

Thanks,

--
Laurent

Attachment: gda-bdb-0.0.3.tar.gz
Description: application/compressed-tar

Index: configure.in
===================================================================
RCS file: /cvs/gnome/libgda/configure.in,v
retrieving revision 1.231
diff -u -r1.231 configure.in
--- configure.in	24 Nov 2003 23:14:47 -0000	1.231
+++ configure.in	28 Nov 2003 13:07:23 -0000
@@ -117,6 +117,47 @@
 *) lib="lib";;
 esac
 
+dnl Test for Berkeley DB
+try_bdb=true
+AC_ARG_WITH(bdb,
+[  --with-bdb=<directory>	use bdb library in <directory>],[
+if test $withval = no
+then
+	try_bdb=false
+elif test $withval = yes
+then
+	dir="/usr"
+else
+	dir=$withval
+fi
+])
+bdbdir=""
+if test $try_bdb = true
+then
+	AC_MSG_CHECKING(for Berkeley DB files)
+	for d in $dir /usr /usr/local
+	do
+		if test -f $d/$lib/libdb.so -a -f $d/include/db.h
+		then
+			AC_MSG_RESULT(found Berkeley DB in $d)
+			bdblib="-ldb"
+			bdbdir=$d
+			break
+		fi
+		dnl FIXME: check for db1 (non-sleepycat implementation)
+	done
+	if test x$bdbdir = x
+	then
+		AC_MSG_WARN(Berkeley DB backend not used)
+	else
+		AC_DEFINE(HAVE_BDB)
+		BDB_CFLAGS="-I${bdbdir}/include"
+		BDB_LIBS="-L${bdbdir}/lib ${bdblib}"
+	fi
+fi
+
+AM_CONDITIONAL(BDB, test x$bdbdir != x)
+
 dnl Test for ODBC
 try_odbc=true
 AC_ARG_WITH(odbc,
@@ -831,6 +872,8 @@
 dnl ******************************
 dnl Variables
 dnl ******************************
+AC_SUBST(BDB_LIBS)
+AC_SUBST(BDB_CFLAGS)
 AC_SUBST(ODBC_LIBS)
 AC_SUBST(ODBC_CFLAGS)
 AC_SUBST(MYSQL_LIBS)
@@ -889,6 +932,7 @@
 libsql/Makefile
 libgda/Makefile
 providers/Makefile
+providers/bdb/Makefile
 providers/freetds/Makefile
 providers/firebird/Makefile
 providers/ibmdb2/Makefile
@@ -922,6 +966,7 @@
 echo "   Installation prefix = $prefix"
 echo "   Providers"
 echo "      XML = yes"
+echo "      Berkeley DB = `if test x$bdbdir != x; then echo yes; else echo no; fi`"
 echo "      FireBird = `if test x$firebirddir != x; then echo yes; else echo no; fi`"
 echo "      FreeTDS = `if test x$freetdsdir != x; then echo yes; else echo no; fi`"
 echo "      IBM DB2 = `if test x$ibmdb2dir != x; then echo yes; else echo no; fi`"
Index: providers/Makefile.am
===================================================================
RCS file: /cvs/gnome/libgda/providers/Makefile.am,v
retrieving revision 1.18
diff -u -r1.18 Makefile.am
--- providers/Makefile.am	4 Jul 2003 16:29:26 -0000	1.18
+++ providers/Makefile.am	28 Nov 2003 13:07:23 -0000
@@ -1,3 +1,7 @@
+if BDB 
+GDA_BDB_SERVER=bdb
+endif
+
 if IBMDB2
 GDA_IBMDB2_SERVER=ibmdb2
 endif
@@ -51,6 +55,7 @@
 endif
 
 SUBDIRS = \
+	$(GDA_BDB_SERVER) \
 	$(GDA_FREETDS_SERVER) \
 	$(GDA_IBMDB2_SERVER) \
 	$(GDA_FIREBIRD_SERVER) \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]