cvs: /php4/ext/odbc config.h.stub config.m4 php_odbc.c php_odbc.h
| From: | Rasmus Lerdorf | Date: | Thu, 28 Oct 1999 20:34:14 +0000 |
| Subject: | cvs: /php4/ext/odbc config.h.stub config.m4 php_odbc.c php_odbc.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-5768@lists.php.net to get a copy of this message | ||
rasmus Thu Oct 28 16:34:14 1999 EDT
Modified files:
/php4/ext/odbc config.h.stub config.m4 php_odbc.c php_odbc.h
Log:
(IBM DB2 Support) Fix stuff to allow IBM DB2 to work with PHP 4.
Tested against DB2 6.1 UDB on Linux (RH-6.0)
Index: php4/ext/odbc/config.h.stub
diff -u php4/ext/odbc/config.h.stub:1.4 php4/ext/odbc/config.h.stub:1.5
--- php4/ext/odbc/config.h.stub:1.4 Thu Sep 23 10:46:35 1999
+++ php4/ext/odbc/config.h.stub Thu Oct 28 16:33:43 1999
@@ -1,4 +1,5 @@
#define HAVE_SOLID 0
+#define HAVE_IBMDB2 0
#define HAVE_IODBC 0
#define HAVE_ESOOB 0
#define HAVE_UNIXODBC 0
Index: php4/ext/odbc/config.m4
diff -u php4/ext/odbc/config.m4:1.6 php4/ext/odbc/config.m4:1.7
--- php4/ext/odbc/config.m4:1.6 Thu Sep 23 10:46:35 1999
+++ php4/ext/odbc/config.m4 Thu Oct 28 16:33:43 1999
@@ -102,6 +102,34 @@
fi
if test -z "$ODBC_TYPE"; then
+AC_MSG_CHECKING(for IBM DB2 support)
+AC_ARG_WITH(ibm-db2,
+[ --with-ibm-db2[=DIR] Include IBM DB2 support. DIR is the DB2 base
+ install directory, defaults to /home/db2inst1/sqllib],
+[
+ if test "$withval" != "no"; then
+ if test "$withval" = "yes"; then
+ ODBC_INCDIR=/home/db2inst1/sqllib/include
+ ODBC_LIBDIR=/home/db2inst1/sqllib/lib
+ else
+ ODBC_INCDIR=$withval/include
+ ODBC_LIBDIR=$withval/lib
+ fi
+ ODBC_INCLUDE=-I$ODBC_INCDIR
+ ODBC_TYPE=db2
+ ODBC_LIBS="-ldb2"
+ AC_DEFINE(HAVE_IBMDB2)
+
+ 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 Empress support)
AC_ARG_WITH(empress,
[ --with-empress[=DIR] Include Empress support. DIR is the Empress base
Index: php4/ext/odbc/php_odbc.c
diff -u php4/ext/odbc/php_odbc.c:1.9 php4/ext/odbc/php_odbc.c:1.10
--- php4/ext/odbc/php_odbc.c:1.9 Fri Oct 15 08:28:20 1999
+++ php4/ext/odbc/php_odbc.c Thu Oct 28 16:33:43 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.c,v 1.9 1999/10/15 12:28:20 zeev Exp $ */
+/* $Id: php_odbc.c,v 1.10 1999/10/28 20:33:43 rasmus Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
@@ -62,7 +62,7 @@
#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0))
/*
- * #if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
+ * #if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC )
SQLHANDLE henv;
#else
HENV henv;
@@ -152,7 +152,7 @@
(UWORD)SQL_COMMIT);
#endif
SQLFreeStmt(res->stmt,SQL_DROP);
-#if !defined( HAVE_DB2 ) && !defined( HAVE_UNIXODBC )
+#if !defined( HAVE_IBMDB2 ) && !defined( HAVE_UNIXODBC )
res->stmt = NULL;
#endif
}
@@ -445,7 +445,7 @@
php_printf("</table>\n");
}
-#if defined ( HAVE_DB2 ) || defined ( HAVE_UNIXODBC )
+#if defined ( HAVE_IBMDB2 ) || defined ( HAVE_UNIXODBC )
void ODBC_SQL_ERROR(SQLHANDLE henv, SQLHANDLE conn, SQLHANDLE stmt, char *func)
#else
void ODBC_SQL_ERROR(HENV henv, HDBC conn, HSTMT stmt, char *func)
Index: php4/ext/odbc/php_odbc.h
diff -u php4/ext/odbc/php_odbc.h:1.5 php4/ext/odbc/php_odbc.h:1.6
--- php4/ext/odbc/php_odbc.h:1.5 Fri Oct 8 15:35:50 1999
+++ php4/ext/odbc/php_odbc.h Thu Oct 28 16:33:43 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.h,v 1.5 1999/10/08 19:35:50 kara Exp $ */
+/* $Id: php_odbc.h,v 1.6 1999/10/28 20:33:43 rasmus Exp $ */
#ifndef _PHP_ODBC_H
#define _PHP_ODBC_H
@@ -118,9 +118,9 @@
#define HAVE_SQL_EXTENDED_FETCH 1
#include <odbc.h>
-#elif HAVE_DB2 /* DB2 CLI */
+#elif HAVE_IBMDB2 /* DB2 CLI */
-#define ODBC_TYPE "DB2 CLI"
+#define ODBC_TYPE "IBM DB2 CLI"
#define HAVE_SQL_EXTENDED_FETCH 1
#include <sqlcli1.h>
#ifdef DB268K
@@ -189,7 +189,7 @@
PHP_FUNCTION(odbc_tableprivileges);
typedef struct odbc_connection {
-#if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
+#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC )
SQLHANDLE henv;
SQLHANDLE hdbc;
#else
@@ -208,7 +208,7 @@
} odbc_result_value;
typedef struct odbc_result {
-#if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
+#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC )
SQLHANDLE stmt;
#else
HSTMT stmt;
@@ -249,7 +249,7 @@
void odbc_del_conn(HashTable *list, int ind);
#define ODBC_SQL_ERROR odbc_sql_error
-#if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
+#if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC )
void odbc_sql_error(SQLHANDLE henv, SQLHANDLE conn, SQLHANDLE stmt, char *func);
#else
void odbc_sql_error(HENV henv, HDBC conn, HSTMT stmt, char *func);