sixd                                     Thu, 03 Jun 2010 07:03:05 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300151

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

Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/dba/config.m4
    U   php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c
    U   php/php-src/branches/PHP_5_3/ext/dba/tests/dba_db4_handlers.phpt
    U   php/php-src/trunk/NEWS
    U   php/php-src/trunk/ext/dba/config.m4
    U   php/php-src/trunk/ext/dba/dba_db4.c
    U   php/php-src/trunk/ext/dba/tests/dba_db4_handlers.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-06-03 07:03:05 UTC (rev 300151)
@@ -19,6 +19,7 @@
 - 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)

Modified: php/php-src/branches/PHP_5_3/ext/dba/config.m4
===================================================================
--- php/php-src/branches/PHP_5_3/ext/dba/config.m4	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/branches/PHP_5_3/ext/dba/config.m4	2010-06-03 07:03:05 UTC (rev 300151)
@@ -83,16 +83,16 @@
 [  --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_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_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 @@
 # 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

Modified: php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/branches/PHP_5_3/ext/dba/dba_db4.c	2010-06-03 07:03:05 UTC (rev 300151)
@@ -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 @@
 	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) {

Modified: php/php-src/branches/PHP_5_3/ext/dba/tests/dba_db4_handlers.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/dba/tests/dba_db4_handlers.phpt	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/branches/PHP_5_3/ext/dba/tests/dba_db4_handlers.phpt	2010-06-03 07:03:05 UTC (rev 300151)
@@ -47,4 +47,4 @@
 Test 1
 Success: db4 enabled
 Test 2 - full info
-.*Berkeley DB 4.*
+.*Berkeley DB (4|5).*

Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/trunk/NEWS	2010-06-03 07:03:05 UTC (rev 300151)
@@ -44,6 +44,7 @@
   numeric strings to integers. (Ilia)
 - Added support for object references in recursive serialize() calls. FR #36424.
   (Mike)
+- Added Berkeley DB 5 support to the DBA extension (Johannes, Chris Jones)

 - default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus)


Modified: php/php-src/trunk/ext/dba/config.m4
===================================================================
--- php/php-src/trunk/ext/dba/config.m4	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/trunk/ext/dba/config.m4	2010-06-03 07:03:05 UTC (rev 300151)
@@ -83,16 +83,16 @@
 [  --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)
@@ -245,7 +245,7 @@
         ],[
           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
           ],[
@@ -268,7 +268,7 @@
     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
     ],[
@@ -309,12 +309,21 @@
 # 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

Modified: php/php-src/trunk/ext/dba/dba_db4.c
===================================================================
--- php/php-src/trunk/ext/dba/dba_db4.c	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/trunk/ext/dba/dba_db4.c	2010-06-03 07:03:05 UTC (rev 300151)
@@ -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 @@
 	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) {

Modified: php/php-src/trunk/ext/dba/tests/dba_db4_handlers.phpt
===================================================================
--- php/php-src/trunk/ext/dba/tests/dba_db4_handlers.phpt	2010-06-03 06:57:47 UTC (rev 300150)
+++ php/php-src/trunk/ext/dba/tests/dba_db4_handlers.phpt	2010-06-03 07:03:05 UTC (rev 300151)
@@ -47,4 +47,4 @@
 Test 1
 Success: db4 enabled
 Test 2 - full info
-.*Berkeley DB 4.*
+.*Berkeley DB (4|5).*
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to