* Make ext/dba compile with newer versions of Oracle's Berkeley (in my case 6.1)

* Make the db3 driver work with 4.3+
This commit is contained in:
Kalle Sommer Nielsen 2015-05-19 12:12:24 +02:00
parent b3d053b036
commit dd527806e9
2 changed files with 16 additions and 3 deletions

View File

@ -4,7 +4,7 @@
ARG_WITH("dba", "DBA support", "no");
if (PHP_DBA != "no") {
if (CHECK_LIB("libdb31s.lib", "dba", PHP_DBA) &&
if (CHECK_LIB("libdb31s.lib;libdb61.lib", "dba", PHP_DBA) &&
CHECK_HEADER_ADD_INCLUDE("db.h", "CFLAGS_DBA")) {
EXTENSION("dba", "dba.c dba_cdb.c dba_db1.c dba_db2.c dba_db3.c dba_dbm.c dba_flatfile.c dba_gdbm.c dba_ndbm.c dba_inifile.c");
ADD_SOURCES("ext/dba/libcdb", "cdb.c cdb_make.c uint32.c", "dba");

View File

@ -25,6 +25,10 @@
#include "php.h"
#if DBA_DB3
#ifdef DBA_IS_MODERN
#undef off_t
#undef ssize_t
#endif
#include "php_db3.h"
#include <sys/stat.h>
@ -35,7 +39,11 @@
#include <db.h>
#endif
static void php_dba_db3_errcall_fcn(const char *errpfx, char *msg)
static void php_dba_db3_errcall_fcn(
#if (DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3))
const DB_ENV *dbenv,
#endif
const char *errpfx, const char *msg)
{
php_error_docref(NULL, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
@ -90,7 +98,12 @@ DBA_OPEN_FUNC(db3)
if ((err=db_create(&dbp, NULL, 0)) == 0) {
dbp->set_errcall(dbp, php_dba_db3_errcall_fcn);
if ((err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) {
if(
#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) {
#endif
dba_db3_data *data;
data = pemalloc(sizeof(*data), info->flags&DBA_PERSISTENT);