cvs: /php4/ext/odbc config.h.stub config.m4 php_odbc.c php_odbc.h setup.stub
| From: | Stig Bakken | Date: | Mon, 29 Nov 1999 00:46:00 +0000 |
| Subject: | cvs: /php4/ext/odbc config.h.stub config.m4 php_odbc.c php_odbc.h setup.stub | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7011@lists.php.net to get a copy of this message | ||
ssb Sun Nov 28 19:46:00 1999 EDT
Modified files:
/php4/ext/odbc config.h.stub config.m4 php_odbc.c php_odbc.h
setup.stub
Log:
Added DBMaker support (patch by Pax Tsai <paxtsai@lion.syscom.com.tw>)
Index: php4/ext/odbc/config.h.stub
diff -u php4/ext/odbc/config.h.stub:1.6 php4/ext/odbc/config.h.stub:1.7
--- php4/ext/odbc/config.h.stub:1.6 Tue Nov 9 09:28:59 1999
+++ php4/ext/odbc/config.h.stub Sun Nov 28 19:45:28 1999
@@ -9,3 +9,4 @@
#undef HAVE_UODBC
#undef HAVE_EMPRESS
#undef HAVE_VELOCIS
+#undef HAVE_DBMAKER
Index: php4/ext/odbc/config.m4
diff -u php4/ext/odbc/config.m4:1.9 php4/ext/odbc/config.m4:1.10
--- php4/ext/odbc/config.m4:1.9 Tue Nov 9 09:28:59 1999
+++ php4/ext/odbc/config.m4 Sun Nov 28 19:45:28 1999
@@ -50,6 +50,27 @@
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,
@@ -322,6 +343,39 @@
ODBC_LIBS=-liodbc
ODBC_TYPE=openlink
AC_DEFINE(HAVE_OPENLINK)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+],[
+ AC_MSG_RESULT(no)
+])
+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)
Index: php4/ext/odbc/php_odbc.c
diff -u php4/ext/odbc/php_odbc.c:1.11 php4/ext/odbc/php_odbc.c:1.12
--- php4/ext/odbc/php_odbc.c:1.11 Tue Nov 9 09:28:59 1999
+++ php4/ext/odbc/php_odbc.c Sun Nov 28 19:45:28 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.c,v 1.11 1999/11/09 14:28:59 ssb Exp $ */
+/* $Id: php_odbc.c,v 1.12 1999/11/29 00:45:28 ssb Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
@@ -99,7 +99,9 @@
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 @@
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 @@
}
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 @@
}
/* }}} */
+#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 @@
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 @@
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 @@
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 @@
}
/* }}} */
+#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 @@
ZEND_REGISTER_RESOURCE(return_value, result, le_result);
}
/* }}} */
+#endif /* HAVE_DBMAKER */
#endif /* HAVE_UODBC */
Index: php4/ext/odbc/php_odbc.h
diff -u php4/ext/odbc/php_odbc.h:1.7 php4/ext/odbc/php_odbc.h:1.8
--- php4/ext/odbc/php_odbc.h:1.7 Tue Nov 9 09:28:59 1999
+++ php4/ext/odbc/php_odbc.h Sun Nov 28 19:45:28 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.h,v 1.7 1999/11/09 14:28:59 ssb Exp $ */
+/* $Id: php_odbc.h,v 1.8 1999/11/29 00:45:28 ssb Exp $ */
#ifndef _PHP_ODBC_H
#define _PHP_ODBC_H
@@ -115,6 +115,13 @@
#define HAVE_SQL_EXTENDED_FETCH 1
#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 */
Index: php4/ext/odbc/setup.stub
diff -u php4/ext/odbc/setup.stub:1.3 php4/ext/odbc/setup.stub:1.4
--- php4/ext/odbc/setup.stub:1.3 Thu Sep 23 10:46:35 1999
+++ php4/ext/odbc/setup.stub Sun Nov 28 19:45:28 1999
@@ -1,4 +1,4 @@
-# $Id: setup.stub,v 1.3 1999/09/23 14:46:35 lurcher Exp $ -*- sh -*-
+# $Id: setup.stub,v 1.4 1999/11/29 00:45:28 ssb Exp $ -*- sh -*-
# Solid
define_option with-solid 'Solid support?' yesnodir \
@@ -84,13 +84,27 @@
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