|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-06-08 17:30 UTC] kalowsky@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
I'm using sybase adaptive server anywhere on linux as sql server and it disconnects clients after some client idle time. There is a check for persistent connection validity, but it does not work. if uses SQLGetInfo(..., SQL_DATA_SOURCE_READ_ONLY, ... but that does not verify the connnection, it returns ok everytime. Only few SQLGetInfo info types are connecting to server, like SQL_SERVER_NAME for example. I think this is server specific, so it would be good to have it as configurable parameter. Also, SQLGetInfo does not return error code if connection is not alive anymore, if only returns empty info data, so that should be checked too. I made a small patch for my php to have it so, here it is (maybe it helps) diff -urN php-4.0.5/ext/odbc/php_odbc.c php/ext/odbc/php_odbc.c --- php-4.0.5/ext/odbc/php_odbc.c Sat Mar 10 00:44:55 2001 +++ php/ext/odbc/php_odbc.c Mon May 7 17:40:11 2001 @@ -309,6 +309,8 @@ defaultbinmode, php_odbc_globals, odbc_globals, display_ binmode) STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpda teInt, check_persistent, php_odbc_globals, odbc_globals) + STD_PHP_INI_ENTRY("odbc.check_persistent_info_type", "25", PHP_INI_SYSTE M, OnUpdateInt, + check_persistent_info_type, php_odbc_globals, odbc_globals) PHP_INI_END() #ifdef ZTS @@ -2087,10 +2089,10 @@ SWORD len; ret = SQLGetInfo(db_conn->hdbc, - SQL_DATA_SOURCE_READ_ONLY, + ODBCG(check_persistent_info_type), d_name, sizeof(d_name), &len); - if(ret != SQL_SUCCESS){ + if(ret != SQL_SUCCESS || len == 0){ zend_hash_del(&EG(persistent_list), hash ed_details, hashed_len + 1); SQLDisconnect(db_conn->hdbc); SQLFreeConnect(db_conn->hdbc); diff -urN php-4.0.5/ext/odbc/php_odbc.h php/ext/odbc/php_odbc.h --- php-4.0.5/ext/odbc/php_odbc.h Sat Mar 10 00:44:55 2001 +++ php/ext/odbc/php_odbc.h Mon May 7 17:33:14 2001 @@ -283,6 +283,7 @@ char *defPW; long allow_persistent; long check_persistent; + long check_persistent_info_type; long max_persistent; long max_links; long num_persistent;