CVS update: php3/functions

From: Date: Fri, 18 Dec 1998 19:25:52 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2847@lists.php.net to get a copy of this message
Date: Friday December 18, 1998 @ 14:25 Author: swilliam Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv6267/functions Modified Files: unified_odbc.c Log Message: Added support for SQLDriverConnect in Empress ODBC interface. unified_odbc.c will use SQLDriverConnect or SQLConnect depending on content of dns name for database. Index: php3/functions/unified_odbc.c diff -c php3/functions/unified_odbc.c:1.95 php3/functions/unified_odbc.c:1.96 *** php3/functions/unified_odbc.c:1.95 Thu Dec 17 08:49:11 1998 --- php3/functions/unified_odbc.c Fri Dec 18 14:25:51 1998 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: unified_odbc.c,v 1.95 1998/12/17 13:49:11 swilliam Exp $ */ /* This file is based on the Adabas D extension. * Adabas D will no longer be supported as separate module. --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: unified_odbc.c,v 1.96 1998/12/18 19:25:51 swilliam Exp $ */ /* This file is based on the Adabas D extension. * Adabas D will no longer be supported as separate module. *************** *** 1820,1828 **** --- 1820,1869 ---- } } + #if HAVE_EMPRESS + { + int direct = 0; + char dsnbuf[300]; + short dsnbuflen; + char *ldb = 0; + + if (strstr ((char*)db, ";")) + { + direct = 1; + if (uid && !strstr ((char*)db, "uid") && + !strstr ((char*)db, "UID")) + { + ldb = (char*) emalloc (strlen(db) + + strlen (uid) + + strlen (pwd) + 12); + sprintf (ldb, "%s;UID=%s;PWD=%s", + db, uid, pwd); + } + else + { + ldb = (char*) emalloc (strlen (db) + 1); + strcat (ldb, db); + } + } + + if (direct) + rc = SQLDriverConnect (db_conn->hdbc, NULL, + ldb, strlen (ldb), dsnbuf, 300, + &dsnbuflen, SQL_DRIVER_NOPROMPT); + + else + rc = SQLConnect(db_conn->hdbc, db, SQL_NTS, + uid, SQL_NTS, pwd, SQL_NTS); + + if (ldb) + efree (ldb); + } + #else rc = SQLConnect(db_conn->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS); + #endif + #endif if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { UODBC_SQL_ERROR(db_conn->hdbc, SQL_NULL_HSTMT, "SQLConnect"); SQLFreeConnect(db_conn->hdbc); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2847) next »