From bd8b285a9e3577d9f8a19c9128d049b0b37d0e59 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Mon, 29 Nov 1999 00:45:28 +0000 Subject: [PATCH] @Added DBMaker support (patch by Pax Tsai ) Added DBMaker support (patch by Pax Tsai ) --- ext/odbc/config.h.stub | 1 + ext/odbc/config.m4 | 54 ++++++++++++++++++++++++++++++++++++++++++ ext/odbc/php_odbc.c | 27 +++++++++++++++++++-- ext/odbc/php_odbc.h | 7 ++++++ ext/odbc/setup.stub | 16 ++++++++++++- 5 files changed, 102 insertions(+), 3 deletions(-) diff --git a/ext/odbc/config.h.stub b/ext/odbc/config.h.stub index e162d9f64b..1c1c8afdab 100644 --- a/ext/odbc/config.h.stub +++ b/ext/odbc/config.h.stub @@ -9,3 +9,4 @@ #undef HAVE_UODBC #undef HAVE_EMPRESS #undef HAVE_VELOCIS +#undef HAVE_DBMAKER diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4 index ee2a0e443e..9158e60fe2 100644 --- a/ext/odbc/config.m4 +++ b/ext/odbc/config.m4 @@ -50,6 +50,27 @@ AC_DEFUN(AC_FIND_EMPRESS_LIBS,[ AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`) ]) +dnl +dnl Figure out the path where the newest DBMaker is installed. +dnl +AC_DEFUN(AC_FIND_DBMAKER_PATH,[ + AC_MSG_CHECKING([DBMaker version]) + if [ test -d "$1/4.0" ]; then + DBMAKER_PATH=$1/4.0 + elif [ test -d "$1/3.6" ]; then + DBMAKER_PATH=$1/3.6 + elif [ test -d "$1/3.5" ]; then + DBMAKER_PATH=$1/3.5 + elif [ test -d "$1/3.01" ]; then + DBMAKER_PATH=$1/3.01 + elif [ test -d "$1/3.0" ]; then + DBMAKER_PATH=$1/3.0 + else + DBMAKER_PATH=$1 + fi + AC_MSG_RESULT(`echo $DBMAKER_PATH | sed -e 's!.*/!!'`) +]) + if test -z "$ODBC_TYPE"; then AC_MSG_CHECKING(for Adabas support) AC_ARG_WITH(adabas, @@ -331,6 +352,39 @@ AC_ARG_WITH(openlink, ]) fi +if test -z "$ODBC_TYPE"; then +AC_MSG_CHECKING(for DBMaker support) +AC_ARG_WITH(dbmaker, +[ --with-dbmaker[=DIR] Include DBMaker support. DIR is the DBMaker base + install directory, defaults to where the latest + version of DBMaker is installed (such as + /home/dbmaker/3.6). +], +[ + if test "$withval" = "yes"; then + # find dbmaker's home directory + DBMAKER_HOME=`grep "^dbmaker:" /etc/passwd | awk -F: '{print $6}'` + AC_FIND_DBMAKER_PATH($DBMAKER_HOME) + withval=$DBMAKER_PATH + fi + if test "$withval" != "no"; then + ODBC_INCDIR=$withval/include + ODBC_LIBDIR=$withval/lib + ODBC_INCLUDE=-I$ODBC_INCDIR + ODBC_LFLAGS=-L$ODBC_LIBDIR + ODBC_INCLUDE=-I$ODBC_INCDIR + ODBC_LIBS="-ldmapic -lc" + ODBC_TYPE=dbmaker + AC_DEFINE(HAVE_DBMAKER) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) +]) +fi + if test -n "$ODBC_TYPE"; then INCLUDES="$INCLUDES $ODBC_INCLUDE" EXTRA_LIBS="$EXTRA_LIBS $ODBC_LFLAGS $ODBC_LIBS" diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index c24c47e084..17a2a730c2 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -99,7 +99,9 @@ function_entry odbc_functions[] = { PHP_FE(odbc_define, NULL)*/ PHP_FE(odbc_tables, NULL) PHP_FE(odbc_columns, NULL) +#ifndef HAVE_DBMAKER /* not supported now */ PHP_FE(odbc_columnprivileges, NULL) +#endif PHP_FE(odbc_foreignkeys, NULL) PHP_FE(odbc_gettypeinfo, NULL) PHP_FE(odbc_primarykeys, NULL) @@ -107,7 +109,9 @@ function_entry odbc_functions[] = { PHP_FE(odbc_procedures, NULL) PHP_FE(odbc_specialcolumns, NULL) PHP_FE(odbc_statistics, NULL) +#ifndef HAVE_DBMAKER /* not supported now */ PHP_FE(odbc_tableprivileges, NULL) +#endif PHP_FALIAS(odbc_do, odbc_exec, NULL) { NULL, NULL, NULL } }; @@ -2021,8 +2025,12 @@ PHP_FUNCTION(odbc_autocommit) } ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); - + +#ifndef HAVE_DBMAKER if ((*pv_onoff)) { +#else + if (pv_onoff && (*pv_onoff)) { +#endif convert_to_long_ex(pv_onoff); rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, ((*pv_onoff)->value.lval) ? @@ -2286,6 +2294,7 @@ PHP_FUNCTION(odbc_columns) } /* }}} */ +#ifndef HAVE_DBMAKER /* {{{ proto int odbc_columnprivileges(int connection_id, string catalog, string schema, string table, string column ) call the SQLColumnPrivileges function */ PHP_FUNCTION(odbc_columnprivileges) @@ -2363,6 +2372,7 @@ PHP_FUNCTION(odbc_columnprivileges) ZEND_REGISTER_RESOURCE(return_value, result, le_result); } /* }}} */ +#endif /* HAVE_DBMAKER */ /* {{{ proto int odbc_foreignkeys(int connection_id, string pk_catalog, string pk_schema, string pk_table, string fk_catalog, string fk_schema, string fk_table ) call the SQLForeignKeys function */ @@ -2395,6 +2405,17 @@ PHP_FUNCTION(odbc_foreignkeys) fschema = (*pv_fschema)->value.str.val; convert_to_string_ex(pv_ftable); ftable = (*pv_ftable)->value.str.val; +#ifdef HAVE_DBMAKER +#define EMPTY_TO_NULL(xstr) \ + if ((int)strlen((xstr)) == 0) (xstr) = NULL + + EMPTY_TO_NULL(pcat); + EMPTY_TO_NULL(pschema); + EMPTY_TO_NULL(ptable); + EMPTY_TO_NULL(fcat); + EMPTY_TO_NULL(fschema); + EMPTY_TO_NULL(ftable); +#endif } else { WRONG_PARAM_COUNT; } @@ -2780,7 +2801,7 @@ PHP_FUNCTION(odbc_specialcolumns) WRONG_PARAM_COUNT; } convert_to_long_ex(pv_type); - type = (SQLUSMALLINT) (*pv_cat)->value.lval; + type = (SQLUSMALLINT) (*pv_type)->value.lval; convert_to_string_ex(pv_cat); cat = (*pv_cat)->value.str.val; convert_to_string_ex(pv_schema); @@ -2931,6 +2952,7 @@ PHP_FUNCTION(odbc_statistics) } /* }}} */ +#ifndef HAVE_DBMAKER /* {{{ proto int odbc_tableprivilegess(int connection_id, string catalog, string schema, string table ) call the SQLTablePrivilegess function */ PHP_FUNCTION(odbc_tableprivileges) @@ -3005,6 +3027,7 @@ PHP_FUNCTION(odbc_tableprivileges) ZEND_REGISTER_RESOURCE(return_value, result, le_result); } /* }}} */ +#endif /* HAVE_DBMAKER */ #endif /* HAVE_UODBC */ diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h index 1e0c36c323..34ff80a0f9 100644 --- a/ext/odbc/php_odbc.h +++ b/ext/odbc/php_odbc.h @@ -116,6 +116,13 @@ PHP_FUNCTION(solid_fetch_prev); #include #include +#elif defined(HAVE_DBMAKER) /* DBMaker */ + +#define ODBC_TYPE "DBMaker" +#define HAVE_SQL_EXTENDED_FETCH 1 +#include + + #elif defined(HAVE_CODBC) /* Custom ODBC */ #define ODBC_TYPE "Custom ODBC" diff --git a/ext/odbc/setup.stub b/ext/odbc/setup.stub index 962a029c63..f257bc5ec9 100644 --- a/ext/odbc/setup.stub +++ b/ext/odbc/setup.stub @@ -84,13 +84,27 @@ define_option with-velocis 'Velocis support?' yesnodir \ More information about Velocis can be found at http://www.raima.com/.' fi -# Custom ODBC +# DBMaker if test "$option_value_with_solid" = "no" -a \ "$option_value_with_empress" = "no" -a \ "$option_value_with_iodbc" = "no" -a \ "$option_value_with_openlink" = "no" -a \ "$option_value_with_adabas" = "no" -a \ "$option_value_with_velocis" = "no"; then +define_option with-dbmaker 'DBMaker support?' yesnodir \ + 'no /home/dbmaker DBMaker install' \ +' Whether to build PHP with DBMaker support. \n + More information about DBMaker can be found at http://www.casemaker.com/.' +fi + +# Custom ODBC +if test "$option_value_with_solid" = "no" -a \ + "$option_value_with_empress" = "no" -a \ + "$option_value_with_iodbc" = "no" -a \ + "$option_value_with_openlink" = "no" -a \ + "$option_value_with_adabas" = "no" -a \ + "$option_value_with_velocis" = "no"; -a \ + "$option_value_with_dbmaker" = "no"; then define_option with-custom-odbc 'custom ODBC support?' yesnodir \ 'no /usr/local CODBC install' \ ' Whether to build PHP with CODBC support. This feature was first -- 2.40.0