summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-05-25 17:44:36 +0000
committerWez Furlong <wez@php.net>2004-05-25 17:44:36 +0000
commit4d232fb17c2caf6c068e6d6309663b4fcb775789 (patch)
treeb66d7cda3182228e2d52157c6921708253feb10e /ext/pdo_odbc
parent7a87af332103f1fc991442dbdabd3972103945ab (diff)
downloadphp-git-4d232fb17c2caf6c068e6d6309663b4fcb775789.tar.gz
Add flag to control the use of the ODBC cursor emulation library.
The default (which should be safe) is to use the cursor library if it is needed. If for some reason either the driver or the emulation is broken, you may override this from your script.
Diffstat (limited to 'ext/pdo_odbc')
-rwxr-xr-xext/pdo_odbc/odbc_driver.c10
-rwxr-xr-xext/pdo_odbc/pdo_odbc.c5
-rwxr-xr-xext/pdo_odbc/php_pdo_odbc_int.h4
3 files changed, 19 insertions, 0 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 23660bc793..ccbaf470e1 100755
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -287,6 +287,7 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D
pdo_odbc_db_handle *H;
RETCODE rc;
int use_direct = 0;
+ SQLUINTEGER cursor_lib;
H = pecalloc(1, sizeof(*H), dbh->is_persistent);
@@ -327,6 +328,15 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D
return 0;
}
}
+
+ /* set up the cursor library, if needed, or if configured explicitly */
+ cursor_lib = pdo_attr_lval(driver_options, PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, SQL_CUR_USE_IF_NEEDED TSRMLS_CC);
+ rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_UINTEGER);
+ if (rc != SQL_SUCCESS) {
+ pdo_odbc_drv_error("SQLSetConnectAttr SQL_ODBC_CURSORS");
+ odbc_handle_closer(dbh TSRMLS_CC);
+ return 0;
+ }
if (strchr(dbh->data_source, ';')) {
char dsnbuf[1024];
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index 09c18cd2a3..e8dc26b5ae 100755
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -109,6 +109,11 @@ PHP_MINIT_FUNCTION(pdo_odbc)
}
#endif
+ REGISTER_LONG_CONSTANT("PDO_ODBC_ATTR_USE_CURSOR_LIBRARY", PDO_ODBC_ATTR_USE_CURSOR_LIBRARY, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PDO_ODBC_SQL_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PDO_ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_CS|CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("PDO_ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC, CONST_CS|CONST_PERSISTENT);
+
return SUCCESS;
}
/* }}} */
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
index 424b3dbdca..e249be5687 100755
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ b/ext/pdo_odbc/php_pdo_odbc_int.h
@@ -149,6 +149,10 @@ extern SQLUINTEGER pdo_odbc_pool_on;
extern SQLUINTEGER pdo_odbc_pool_mode;
#endif
+enum {
+ PDO_ODBC_ATTR_USE_CURSOR_LIBRARY = PDO_ATTR_DRIVER_SPECIFIC,
+};
+
/*
* Local variables:
* tab-width: 4