1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
|