]> granicus.if.org Git - php/commitdiff
@Added DBMaker support (patch by Pax Tsai <paxtsai@lion.syscom.com.tw>)
authorStig Bakken <ssb@php.net>
Mon, 29 Nov 1999 00:45:28 +0000 (00:45 +0000)
committerStig Bakken <ssb@php.net>
Mon, 29 Nov 1999 00:45:28 +0000 (00:45 +0000)
Added DBMaker support (patch by Pax Tsai <paxtsai@lion.syscom.com.tw>)

ext/odbc/config.h.stub
ext/odbc/config.m4
ext/odbc/php_odbc.c
ext/odbc/php_odbc.h
ext/odbc/setup.stub

index e162d9f64b76fb60610f34c15451b099f2e46109..1c1c8afdab4877d3c30d9b5b5e91878a6ef8a6e4 100644 (file)
@@ -9,3 +9,4 @@
 #undef HAVE_UODBC
 #undef HAVE_EMPRESS
 #undef HAVE_VELOCIS
+#undef HAVE_DBMAKER
index ee2a0e443e9bf76762a6e173d4e3071f14c7299f..9158e60fe2fb4add5bda4ed3e0a4fe716450dc07 100644 (file)
@@ -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"
index c24c47e0846f8db5b1d6894c37a27efeb26ed055..17a2a730c2e4c17c42599cf800ac0a70e3718798 100644 (file)
@@ -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 */
 
index 1e0c36c3232d0a19ecefa197434eaade38dd79e7..34ff80a0f95ae652bdc12791109242a2e30d4acb 100644 (file)
@@ -116,6 +116,13 @@ PHP_FUNCTION(solid_fetch_prev);
 #include <sql.h>
 #include <sqlext.h>
 
+#elif defined(HAVE_DBMAKER) /* DBMaker */
+
+#define ODBC_TYPE "DBMaker"
+#define HAVE_SQL_EXTENDED_FETCH 1
+#include <odbc.h>
+
+
 #elif defined(HAVE_CODBC) /* Custom ODBC */
 
 #define ODBC_TYPE "Custom ODBC"
index 962a029c632a4a30da7e2349cf957d296d3afcf0..f257bc5ec9b1217df5036635d4cf222ca4348b48 100644 (file)
@@ -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