wez Thu Nov 24 21:33:05 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/pdo_odbc pdo_odbc.c
Log:
Add pdo_odbc.db2_instance_name ini setting when built against DB2.
This is a convenience for setting up the DB2 environment more easily.
http://cvs.php.net/diff.php/php-src/ext/pdo_odbc/pdo_odbc.c?r1=1.14.2.3&r2=1.14.2.4&ty=u
Index: php-src/ext/pdo_odbc/pdo_odbc.c
diff -u php-src/ext/pdo_odbc/pdo_odbc.c:1.14.2.3
php-src/ext/pdo_odbc/pdo_odbc.c:1.14.2.4
--- php-src/ext/pdo_odbc/pdo_odbc.c:1.14.2.3 Mon Oct 17 21:05:22 2005
+++ php-src/ext/pdo_odbc/pdo_odbc.c Thu Nov 24 21:33:04 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_odbc.c,v 1.14.2.3 2005/10/18 01:05:22 dbs Exp $ */
+/* $Id: pdo_odbc.c,v 1.14.2.4 2005/11/25 02:33:04 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -74,6 +74,13 @@
SQLUINTEGER pdo_odbc_pool_mode = SQL_CP_ONE_PER_HENV;
#endif
+#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
+PHP_INI_BEGIN()
+ PHP_INI_ENTRY("pdo_odbc.db2_instance_name", NULL, PHP_INI_SYSTEM, NULL)
+PHP_INI_END()
+
+#endif
+
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(pdo_odbc)
{
@@ -85,6 +92,20 @@
return FAILURE;
}
+#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
+ REGISTER_INI_ENTRIES();
+ {
+ char *instance = INI_STR("pdo_odbc.db2_instance_name");
+ if (instance) {
+ char *env = malloc(sizeof("DB2INSTANCE=") +
strlen(instance));
+ strcpy(env, "DB2INSTANCE=");
+ strcat(env, instance);
+ putenv(env);
+ /* after this point, we can't free env without breaking
the environment */
+ }
+ }
+#endif
+
#ifdef SQL_ATTR_CONNECTION_POOLING
/* ugh, we don't really like .ini stuff in PDO, but since ODBC
connection
* pooling is process wide, we can't set it from within the scope of a
@@ -125,6 +146,9 @@
*/
PHP_MSHUTDOWN_FUNCTION(pdo_odbc)
{
+#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
+ UNREGISTER_INI_ENTRIES();
+#endif
php_pdo_unregister_driver(&pdo_odbc_driver);
return SUCCESS;
}
@@ -144,6 +168,9 @@
#endif
php_info_print_table_end();
+#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
+ DISPLAY_INI_ENTRIES();
+#endif
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php