Add Berkeley DB 5 support. (An outstanding issue with BDB 4.8 related to 51086 that also affects BDB 5 is not yet resolved)

This commit is contained in:
Christopher Jones 2010-06-03 07:03:05 +00:00
parent 8454cca44c
commit 9ef6a73dee
4 changed files with 23 additions and 13 deletions

1
NEWS
View File

@ -19,6 +19,7 @@ PHP NEWS
- Added FastCGI Process Manager (FPM) SAPI. (Tony)
- Added recent Windows versions to php_uname and fix undefined windows
version support. (Pierre)
- Added Berkeley DB 5 support to the DBA extension (Johannes, Chris Jones)
- Changed namespaced classes so that the ctor can only be named
__construct now. (Stas)

View File

@ -83,16 +83,16 @@ PHP_ARG_WITH(ndbm,,
[ --with-ndbm[=DIR] DBA: NDBM support], no, no)
PHP_ARG_WITH(db4,,
[ --with-db4[=DIR] DBA: Berkeley DB4 support], no, no)
[ --with-db4[=DIR] DBA: Oracle Berkeley DB 4.x or 5.x support], no, no)
PHP_ARG_WITH(db3,,
[ --with-db3[=DIR] DBA: Berkeley DB3 support], no, no)
[ --with-db3[=DIR] DBA: Oracle Berkeley DB 3.x support], no, no)
PHP_ARG_WITH(db2,,
[ --with-db2[=DIR] DBA: Berkeley DB2 support], no, no)
[ --with-db2[=DIR] DBA: Oracle Berkeley DB 2.x support], no, no)
PHP_ARG_WITH(db1,,
[ --with-db1[=DIR] DBA: Berkeley DB1 support/emulation], no, no)
[ --with-db1[=DIR] DBA: Oracle Berkeley DB 1.x support/emulation], no, no)
PHP_ARG_WITH(dbm,,
[ --with-dbm[=DIR] DBA: DBM support], no, no)
@ -210,7 +210,7 @@ AC_DEFUN([PHP_DBA_DB_CHECK],[
],[
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
#if DB_VERSION_MAJOR == $1
#if DB_VERSION_MAJOR == $1 || ($1 == 4 && DB_VERSION_MAJOR == 5)
yes
#endif
],[
@ -233,7 +233,7 @@ AC_DEFUN([PHP_DBA_DB_CHECK],[
AC_MSG_CHECKING([for DB4 minor version and patch level])
AC_EGREP_CPP(yes,[
#include "$THIS_INCLUDE"
#if DB_VERSION_MINOR != 1 || DB_VERSION_PATCH >= 25
#if DB_VERSION_MINOR != 1 || (DB_VERSION_MINOR == 1 && DB_VERSION_PATCH >= 25)
yes
#endif
],[
@ -274,12 +274,21 @@ AC_DEFUN([PHP_DBA_DB_CHECK],[
# DB4
if test "$PHP_DB4" != "no"; then
PHP_DBA_STD_BEGIN
dbdp="/usr/local/BerkeleyDB.4."
for i in $PHP_DB4 ${dbdp}8 ${dbdp}7 ${dbdp}6 ${dbdp}5 ${dbdp}4 ${dbdp}3 ${dbdp}2 ${dbdp}1 ${dbdp}0 /usr/local /usr; do
if test -f "$i/db4/db.h"; then
dbdp4="/usr/local/BerkeleyDB.4."
dbdp5="/usr/local/BerkeleyDB.5."
for i in $PHP_DB4 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do
if test -f "$i/db5/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/db5/db.h
break
elif test -f "$i/db4/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/db4/db.h
break
elif test -f "$i/include/db5.0/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db5.0/db.h
break
elif test -f "$i/include/db4.8/db.h"; then
THIS_PREFIX=$i
THIS_INCLUDE=$i/include/db4.8/db.h

View File

@ -37,14 +37,14 @@
#endif
static void php_dba_db4_errcall_fcn(
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
#if (DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3))
const DB_ENV *dbenv,
#endif
const char *errpfx, const char *msg)
{
TSRMLS_FETCH();
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8 && DB_VERSION_PATCH <= 26)
#if (DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8))
/* Bug 51086, Berkeley DB 4.8.26 */
/* This code suppresses a BDB 4.8 error message that BDB incorrectly emits */
{
@ -124,7 +124,7 @@ DBA_OPEN_FUNC(db4)
if ((err=db_create(&dbp, NULL, 0)) == 0) {
dbp->set_errcall(dbp, php_dba_db4_errcall_fcn);
if (
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
#if (DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1))
(err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) {
#else
(err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) {

View File

@ -47,4 +47,4 @@ database handler: db4
Test 1
Success: db4 enabled
Test 2 - full info
.*Berkeley DB 4.*
.*Berkeley DB (4|5).*