summaryrefslogtreecommitdiffstats
path: root/dev-lang/php/files/php532-ds-odbc_timeout.patch
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-09-01 00:00:32 +0200
commitca9627e70852f6b2e835660df870fe3ab405882d (patch)
tree0a008b1d5b16fa0679a195ed7b5662c7891f591c /dev-lang/php/files/php532-ds-odbc_timeout.patch
downloaddarklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.gz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.bz2
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.xz
darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.zip
Initial import
Diffstat (limited to 'dev-lang/php/files/php532-ds-odbc_timeout.patch')
-rw-r--r--dev-lang/php/files/php532-ds-odbc_timeout.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/dev-lang/php/files/php532-ds-odbc_timeout.patch b/dev-lang/php/files/php532-ds-odbc_timeout.patch
new file mode 100644
index 0000000..0014420
--- /dev/null
+++ b/dev-lang/php/files/php532-ds-odbc_timeout.patch
@@ -0,0 +1,43 @@
+diff -dPNur php-5.3.2/ext/pdo_odbc/odbc_driver.c php-5.3.2-ds/ext/pdo_odbc/odbc_driver.c
+--- php-5.3.2/ext/pdo_odbc/odbc_driver.c 2010-02-03 20:48:04.000000000 +0100
++++ php-5.3.2-ds/ext/pdo_odbc/odbc_driver.c 2010-08-08 00:43:03.000000000 +0200
+@@ -338,11 +338,17 @@
+
+ static int odbc_handle_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC)
+ {
++ SQLRETURN ret;
+ pdo_odbc_db_handle *H = (pdo_odbc_db_handle *)dbh->driver_data;
+ switch (attr) {
+ case PDO_ODBC_ATTR_ASSUME_UTF8:
+ H->assume_utf8 = zval_is_true(val);
+ return 1;
++ case PDO_ATTR_TIMEOUT:
++ convert_to_long(val);
++ ret = SQLSetConnectAttr(H->dbc, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)Z_LVAL_P(val), SQL_IS_UINTEGER);
++ if ((ret == SQL_SUCCESS)||(ret == SQL_SUCCESS_WITH_INFO)) return 1;
++ return 0;
+ default:
+ strcpy(H->einfo.last_err_msg, "Unknown Attribute");
+ H->einfo.what = "setAttribute";
+@@ -394,6 +400,7 @@
+ RETCODE rc;
+ int use_direct = 0;
+ SQLUINTEGER cursor_lib;
++ SQLUINTEGER timeout;
+
+ H = pecalloc(1, sizeof(*H), dbh->is_persistent);
+
+@@ -438,6 +445,12 @@
+ goto fail;
+ }
+
++ timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, -1 TSRMLS_CC);
++ if (timeout != (SQLUINTEGER)-1) {
++ SQLSetConnectAttr(H->dbc, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)timeout, SQL_IS_UINTEGER);
++ SQLSetConnectAttr(H->dbc, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)timeout, SQL_IS_UINTEGER);
++ }
++
+ if (strchr(dbh->data_source, ';')) {
+ char dsnbuf[1024];
+ short dsnbuflen;
+diff -dPNur php-5.3.2/php529-ds-odbc_timeout.patch php-5.3.2-ds/php529-ds-odbc_timeout.patch