summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc/odbc_driver.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-05-22 14:51:26 +0000
committerWez Furlong <wez@php.net>2004-05-22 14:51:26 +0000
commit35494bb569aa83c26550a8863f681d0fd641940c (patch)
tree0b5b11167670a355335969022e37f6bbd632da62 /ext/pdo_odbc/odbc_driver.c
parentce5e317cc5f26aa01bc0d04a8c133fc5a3001262 (diff)
downloadphp-git-35494bb569aa83c26550a8863f681d0fd641940c.tar.gz
Enable ODBC Connection Pooling.
Theoretically better than PHP persistent connections, since ODBC itself takes care of resetting the connections back to a "ground" state. Connection pooling defaults to ON, since this is generally useful. You can turn it off by using: pdo_odbc.connection_pooling=off in your php.ini file. You may configure how ODBC matches connection details to existing connections by setting this value to "strict" (the default) or "relaxed". You are encouraged to read the ODBC specs before changing this value.
Diffstat (limited to 'ext/pdo_odbc/odbc_driver.c')
-rwxr-xr-xext/pdo_odbc/odbc_driver.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index f9d001fbb6..d12459229d 100755
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -300,6 +300,17 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D
odbc_handle_closer(dbh TSRMLS_CC);
return 0;
}
+
+#ifdef SQL_ATTR_CONNECTION_POOLING
+ if (pdo_odbc_pool_on != SQL_CP_OFF) {
+ rc = SQLSetEnvAttr(H->env, SQL_ATTR_CP_MATCH, (void*)pdo_odbc_pool_mode, 0);
+ if (rc != SQL_SUCCESS) {
+ pdo_odbc_drv_error("SQLSetEnvAttr: SQL_ATTR_CP_MATCH");
+ odbc_handle_closer(dbh TSRMLS_CC);
+ return 0;
+ }
+ }
+#endif
rc = SQLAllocHandle(SQL_HANDLE_DBC, H->env, &H->dbc);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {