[PATCH] --with-ODBCRouter (database networking)
| From: | AugSoft | Date: | Fri, 07 Jan 2005 17:02:12 +0000 |
| Subject: | [PATCH] --with-ODBCRouter (database networking) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-14311@lists.php.net to get a copy of this message | ||
Hi,
+ This patch enables PHP's ODBC extension on
certain non-Windows platforms (Linux, Mac OS X,
etc.) to transparently interact with any of the
data sources listed in the SystemDSN property-tab
of the "Data Sources (ODBC) Control Panel" on a
networked Windows NT4/2K/XP box running our ODBC
Router. Once installed, the PHP scripts will
appear to be fully-supported Windows applications
to virtually any data source while the data
sources themselves, which may be on mainframe,
mini, *NIX, Mac or Windows, will appear to be
local to the PHP script. All database
communication takes place transparently, via
high-performance binary TCP/IP connections (not
XML, TELNET, etc.) This technology was introduced
in 1995 and the product system is in use by
FORTUNE 500 companies and at sites across Asia,
Canada, Europe, Oceania and the US.
+ Once applied, support for ODBCRouter may be
compiled into PHP 4.3 by simply adding
"--with-ODBCRouter" to the configure command.
The only pre-compile-time configuration required
is to install our free runtime library. The only
post-compile configuration required is to specify
the IP address of the PC running ODBC Router in
/etc/odbcrouter.conf (at which point, all DSNs on
that PC may be referenced from within local PHP
scripts).
+ Currently, ODBC Router users with PHP 4.3.10
on Linux-X86 follow these procedures:
# rpm -ivh http://odbcrouter.com/m/linux-x86
# rpm -qi iodbc.net (instructions)
+ However, attached to this message are two patch
files, one for the current 4.3.10 release (also
distributed in the above RPM) and one for the
current cvs release (as of the date of this
message) for incorporation into the main-line code
base.
+ ODBC Router client components, such as the
iodbc.net runtime library for Linux, are freely
distributable. Interested parties may also
download evaluation ODBC Router servers from
http://odbcrouter.com/downloadns.shtml
+ Official PHP developers and the first 100
significant code contributors may receive a
complimentary (no charge) ODBC Router server for
their NT4/2K/XP box by e-mailing us with enough
info for us to confirm their actual project
participation.
Very Kind Regards,
August Software
diff -cr ../php-src/ext/odbc/config.m4 odbc_modified_cvs/config.m4 *** ../php-src/ext/odbc/config.m4 2004-12-29 23:02:18.000000000 -0800 --- odbc_modified_cvs/config.m4 2005-01-07 07:49:42.838220854 -0800 *************** *** 210,215 **** --- 210,242 ---- fi if test -z "$ODBC_TYPE"; then + AC_MSG_CHECKING(for ODBCRouter.com support) + AC_ARG_WITH(ODBCRouter, + [ --with-ODBCRouter[=DIR] Include ODBCRouter.com support. DIR is ODBCRouter base + install directory, defaults to /usr.], + [ + PHP_WITH_SHARED + if test "$withval" = "yes"; then + withval=/usr + fi + if test "$withval" != "no"; then + ODBC_INCDIR=$withval/include + ODBC_LIBDIR=$withval/lib + ODBC_LFLAGS=-L$ODBC_LIBDIR + ODBC_INCLUDE=-I$ODBC_INCDIR + ODBC_LIBS=-lodbcsdk + ODBC_TYPE=ODBCRouter + AC_DEFINE(HAVE_ODBC_ROUTER,1,[ ]) + 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 Only in ../php-src/ext/odbc: CVS Only in ../php-src/ext/odbc: .cvsignore diff -cr ../php-src/ext/odbc/php_odbc.c odbc_modified_cvs/php_odbc.c *** ../php-src/ext/odbc/php_odbc.c 2004-06-17 17:44:40.000000000 -0700 --- odbc_modified_cvs/php_odbc.c 2005-01-07 07:46:27.221029151 -0800 *************** *** 2072,2077 **** --- 2072,2118 ---- SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION, SQL_SOLID_XLATOPT_NOCNV); #endif + #ifdef HAVE_ODBC_ROUTER + { + #define CONNSTRSIZE 2048 + char *lpszConnStr = emalloc(CONNSTRSIZE); + if (lpszConnStr && db) { + short cbszConnStr; + if (strstr(db, ";")) { + /* the caller has apparently passed a connection-string */ + if (strstr(db, "uid") || strstr(db, "UID")) { + uid = NULL; + } + if (strstr(db, "pwd") || strstr(db, "PWD")) { + pwd = NULL; + } + strncpy( lpszConnStr, db, CONNSTRSIZE); + } + else { + strcpy(lpszConnStr, "DSN="); + strcat(lpszConnStr, db); + } + if (uid) { + if (uid[0]) { + strcat(lpszConnStr, ";UID="); + strcat(lpszConnStr, uid); + strcat(lpszConnStr, ";"); + } + if (pwd) { + if (pwd[0]) { + strcat(lpszConnStr, "PWD="); + strcat(lpszConnStr, pwd); + strcat(lpszConnStr, ";"); + } + } + } + rc = SQLDriverConnect((*conn)->hdbc, NULL, lpszConnStr, SQL_NTS, + lpszConnStr, CONNSTRSIZE, &cbszConnStr, + SQL_DRIVER_NOPROMPT); + efree(lpszConnStr); + } + } + #else #ifdef HAVE_OPENLINK { char dsnbuf[1024]; *************** *** 2130,2135 **** --- 2171,2177 ---- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS); #endif #endif + #endif if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect"); SQLFreeConnect((*conn)->hdbc); diff -cr ../php-src/ext/odbc/php_odbc_includes.h odbc_modified_cvs/php_odbc_includes.h *** ../php-src/ext/odbc/php_odbc_includes.h 2003-07-14 09:13:30.000000000 -0700 --- odbc_modified_cvs/php_odbc_includes.h 2005-01-07 07:46:15.007013236 -0800 *************** *** 126,131 **** --- 126,145 ---- #include <sqlext.h> #define HAVE_SQL_EXTENDED_FETCH 1 + #elif defined(HAVE_ODBC_ROUTER) /* ODBCRouter.com */ + + #ifdef CHAR + #undef CHAR + #endif + + #ifdef SQLCHAR + #undef SQLCHAR + #endif + + #define ODBC_TYPE "ODBCRouter" + #include <odbcsdk.h> + #undef HAVE_SQL_EXTENDED_FETCH + #elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */ #define ODBC_TYPE "Openlink" diff -cr ../php-4.3.10/ext/odbc/config.m4 odbc_modified_4.3.10/config.m4 *** ../php-4.3.10/ext/odbc/config.m4 2003-11-25 00:08:30.000000000 -0800 --- odbc_modified_4.3.10/config.m4 2005-01-04 03:37:31.000000000 -0800 *************** *** 210,215 **** --- 210,242 ---- fi if test -z "$ODBC_TYPE"; then + AC_MSG_CHECKING(for ODBCRouter.com support) + AC_ARG_WITH(ODBCRouter, + [ --with-ODBCRouter[=DIR] Include ODBCRouter support. DIR is the ODBCRouter base + install directory, defaults to /usr.], + [ + PHP_WITH_SHARED + if test "$withval" = "yes"; then + withval=/usr + fi + if test "$withval" != "no"; then + ODBC_INCDIR=$withval/include + ODBC_LIBDIR=$withval/lib + ODBC_LFLAGS=-L$ODBC_LIBDIR + ODBC_INCLUDE=-I$ODBC_INCDIR + ODBC_LIBS=-lodbcsdk + ODBC_TYPE=ODBCRouter + AC_DEFINE(HAVE_ODBC_ROUTER,1,[ ]) + 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 diff -cr ../php-4.3.10/ext/odbc/php_odbc.c odbc_modified_4.3.10/php_odbc.c *** ../php-4.3.10/ext/odbc/php_odbc.c 2004-06-17 17:44:40.000000000 -0700 --- odbc_modified_4.3.10/php_odbc.c 2005-01-04 03:42:07.000000000 -0800 *************** *** 2072,2077 **** --- 2072,2118 ---- SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION, SQL_SOLID_XLATOPT_NOCNV); #endif + #ifdef HAVE_ODBC_ROUTER + { + #define CONNSTRSIZE 2048 + char *lpszConnStr = emalloc(CONNSTRSIZE); + if (lpszConnStr && db) { + short cbszConnStr; + if (strstr(db, ";")) { + /* the caller has apparently passed a connection-string */ + if (strstr(db, "uid") || strstr(db, "UID")) { + uid = NULL; + } + if (strstr(db, "pwd") || strstr(db, "PWD")) { + pwd = NULL; + } + strncpy( lpszConnStr, db, CONNSTRSIZE); + } + else { + strcpy(lpszConnStr, "DSN="); + strcat(lpszConnStr, db); + } + if (uid) { + if (uid[0]) { + strcat(lpszConnStr, ";UID="); + strcat(lpszConnStr, uid); + strcat(lpszConnStr, ";"); + } + if (pwd) { + if (pwd[0]) { + strcat(lpszConnStr, "PWD="); + strcat(lpszConnStr, pwd); + strcat(lpszConnStr, ";"); + } + } + } + rc = SQLDriverConnect((*conn)->hdbc, NULL, lpszConnStr, SQL_NTS, + lpszConnStr, CONNSTRSIZE, &cbszConnStr, + SQL_DRIVER_NOPROMPT); + efree(lpszConnStr); + } + } + #else #ifdef HAVE_OPENLINK { char dsnbuf[1024]; *************** *** 2130,2135 **** --- 2171,2177 ---- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS); #endif #endif + #endif if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect"); SQLFreeConnect((*conn)->hdbc); diff -cr ../php-4.3.10/ext/odbc/php_odbc_includes.h odbc_modified_4.3.10/php_odbc_includes.h *** ../php-4.3.10/ext/odbc/php_odbc_includes.h 2003-07-14 09:13:30.000000000 -0700 --- odbc_modified_4.3.10/php_odbc_includes.h 2005-01-04 03:40:00.000000000 -0800 *************** *** 126,131 **** --- 126,145 ---- #include <sqlext.h> #define HAVE_SQL_EXTENDED_FETCH 1 + #elif defined(HAVE_ODBC_ROUTER) /* ODBCRouter.com */ + + #ifdef CHAR + #undef CHAR + #endif + + #ifdef SQLCHAR + #undef SQLCHAR + #endif + + #define ODBC_TYPE "ODBCRouter" + #include <odbcsdk.h> + #undef HAVE_SQL_EXTENDED_FETCH + #elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */ #define ODBC_TYPE "Openlink"
diff -cr ../php-src/ext/odbc/config.m4 odbc_modified_cvs/config.m4 *** ../php-src/ext/odbc/config.m4 2004-12-29 23:02:18.000000000 -0800 --- odbc_modified_cvs/config.m4 2005-01-07 07:49:42.838220854 -0800 *************** *** 210,215 **** --- 210,242 ---- fi if test -z "$ODBC_TYPE"; then + AC_MSG_CHECKING(for ODBCRouter.com support) + AC_ARG_WITH(ODBCRouter, + [ --with-ODBCRouter[=DIR] Include ODBCRouter.com support. DIR is ODBCRouter base + install directory, defaults to /usr.], + [ + PHP_WITH_SHARED + if test "$withval" = "yes"; then + withval=/usr + fi + if test "$withval" != "no"; then + ODBC_INCDIR=$withval/include + ODBC_LIBDIR=$withval/lib + ODBC_LFLAGS=-L$ODBC_LIBDIR + ODBC_INCLUDE=-I$ODBC_INCDIR + ODBC_LIBS=-lodbcsdk + ODBC_TYPE=ODBCRouter + AC_DEFINE(HAVE_ODBC_ROUTER,1,[ ]) + 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 Only in ../php-src/ext/odbc: CVS Only in ../php-src/ext/odbc: .cvsignore diff -cr ../php-src/ext/odbc/php_odbc.c odbc_modified_cvs/php_odbc.c *** ../php-src/ext/odbc/php_odbc.c 2004-06-17 17:44:40.000000000 -0700 --- odbc_modified_cvs/php_odbc.c 2005-01-07 07:46:27.221029151 -0800 *************** *** 2072,2077 **** --- 2072,2118 ---- SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION, SQL_SOLID_XLATOPT_NOCNV); #endif + #ifdef HAVE_ODBC_ROUTER + { + #define CONNSTRSIZE 2048 + char *lpszConnStr = emalloc(CONNSTRSIZE); + if (lpszConnStr && db) { + short cbszConnStr; + if (strstr(db, ";")) { + /* the caller has apparently passed a connection-string */ + if (strstr(db, "uid") || strstr(db, "UID")) { + uid = NULL; + } + if (strstr(db, "pwd") || strstr(db, "PWD")) { + pwd = NULL; + } + strncpy( lpszConnStr, db, CONNSTRSIZE); + } + else { + strcpy(lpszConnStr, "DSN="); + strcat(lpszConnStr, db); + } + if (uid) { + if (uid[0]) { + strcat(lpszConnStr, ";UID="); + strcat(lpszConnStr, uid); + strcat(lpszConnStr, ";"); + } + if (pwd) { + if (pwd[0]) { + strcat(lpszConnStr, "PWD="); + strcat(lpszConnStr, pwd); + strcat(lpszConnStr, ";"); + } + } + } + rc = SQLDriverConnect((*conn)->hdbc, NULL, lpszConnStr, SQL_NTS, + lpszConnStr, CONNSTRSIZE, &cbszConnStr, + SQL_DRIVER_NOPROMPT); + efree(lpszConnStr); + } + } + #else #ifdef HAVE_OPENLINK { char dsnbuf[1024]; *************** *** 2130,2135 **** --- 2171,2177 ---- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS); #endif #endif + #endif if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect"); SQLFreeConnect((*conn)->hdbc); diff -cr ../php-src/ext/odbc/php_odbc_includes.h odbc_modified_cvs/php_odbc_includes.h *** ../php-src/ext/odbc/php_odbc_includes.h 2003-07-14 09:13:30.000000000 -0700 --- odbc_modified_cvs/php_odbc_includes.h 2005-01-07 07:46:15.007013236 -0800 *************** *** 126,131 **** --- 126,145 ---- #include <sqlext.h> #define HAVE_SQL_EXTENDED_FETCH 1 + #elif defined(HAVE_ODBC_ROUTER) /* ODBCRouter.com */ + + #ifdef CHAR + #undef CHAR + #endif + + #ifdef SQLCHAR + #undef SQLCHAR + #endif + + #define ODBC_TYPE "ODBCRouter" + #include <odbcsdk.h> + #undef HAVE_SQL_EXTENDED_FETCH + #elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */ #define ODBC_TYPE "Openlink" diff -cr ../php-4.3.10/ext/odbc/config.m4 odbc_modified_4.3.10/config.m4 *** ../php-4.3.10/ext/odbc/config.m4 2003-11-25 00:08:30.000000000 -0800 --- odbc_modified_4.3.10/config.m4 2005-01-04 03:37:31.000000000 -0800 *************** *** 210,215 **** --- 210,242 ---- fi if test -z "$ODBC_TYPE"; then + AC_MSG_CHECKING(for ODBCRouter.com support) + AC_ARG_WITH(ODBCRouter, + [ --with-ODBCRouter[=DIR] Include ODBCRouter support. DIR is the ODBCRouter base + install directory, defaults to /usr.], + [ + PHP_WITH_SHARED + if test "$withval" = "yes"; then + withval=/usr + fi + if test "$withval" != "no"; then + ODBC_INCDIR=$withval/include + ODBC_LIBDIR=$withval/lib + ODBC_LFLAGS=-L$ODBC_LIBDIR + ODBC_INCLUDE=-I$ODBC_INCDIR + ODBC_LIBS=-lodbcsdk + ODBC_TYPE=ODBCRouter + AC_DEFINE(HAVE_ODBC_ROUTER,1,[ ]) + 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 diff -cr ../php-4.3.10/ext/odbc/php_odbc.c odbc_modified_4.3.10/php_odbc.c *** ../php-4.3.10/ext/odbc/php_odbc.c 2004-06-17 17:44:40.000000000 -0700 --- odbc_modified_4.3.10/php_odbc.c 2005-01-04 03:42:07.000000000 -0800 *************** *** 2072,2077 **** --- 2072,2118 ---- SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION, SQL_SOLID_XLATOPT_NOCNV); #endif + #ifdef HAVE_ODBC_ROUTER + { + #define CONNSTRSIZE 2048 + char *lpszConnStr = emalloc(CONNSTRSIZE); + if (lpszConnStr && db) { + short cbszConnStr; + if (strstr(db, ";")) { + /* the caller has apparently passed a connection-string */ + if (strstr(db, "uid") || strstr(db, "UID")) { + uid = NULL; + } + if (strstr(db, "pwd") || strstr(db, "PWD")) { + pwd = NULL; + } + strncpy( lpszConnStr, db, CONNSTRSIZE); + } + else { + strcpy(lpszConnStr, "DSN="); + strcat(lpszConnStr, db); + } + if (uid) { + if (uid[0]) { + strcat(lpszConnStr, ";UID="); + strcat(lpszConnStr, uid); + strcat(lpszConnStr, ";"); + } + if (pwd) { + if (pwd[0]) { + strcat(lpszConnStr, "PWD="); + strcat(lpszConnStr, pwd); + strcat(lpszConnStr, ";"); + } + } + } + rc = SQLDriverConnect((*conn)->hdbc, NULL, lpszConnStr, SQL_NTS, + lpszConnStr, CONNSTRSIZE, &cbszConnStr, + SQL_DRIVER_NOPROMPT); + efree(lpszConnStr); + } + } + #else #ifdef HAVE_OPENLINK { char dsnbuf[1024]; *************** *** 2130,2135 **** --- 2171,2177 ---- rc = SQLConnect((*conn)->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS); #endif #endif + #endif if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(*conn, SQL_NULL_HSTMT, "SQLConnect"); SQLFreeConnect((*conn)->hdbc); diff -cr ../php-4.3.10/ext/odbc/php_odbc_includes.h odbc_modified_4.3.10/php_odbc_includes.h *** ../php-4.3.10/ext/odbc/php_odbc_includes.h 2003-07-14 09:13:30.000000000 -0700 --- odbc_modified_4.3.10/php_odbc_includes.h 2005-01-04 03:40:00.000000000 -0800 *************** *** 126,131 **** --- 126,145 ---- #include <sqlext.h> #define HAVE_SQL_EXTENDED_FETCH 1 + #elif defined(HAVE_ODBC_ROUTER) /* ODBCRouter.com */ + + #ifdef CHAR + #undef CHAR + #endif + + #ifdef SQLCHAR + #undef SQLCHAR + #endif + + #define ODBC_TYPE "ODBCRouter" + #include <odbcsdk.h> + #undef HAVE_SQL_EXTENDED_FETCH + #elif defined(HAVE_OPENLINK) /* OpenLink ODBC drivers */ #define ODBC_TYPE "Openlink"