Hi,
I have the following situation. At our company we have our own database and have written our own odbc driver. Using php we can access our database without any problem.
What now occurs is the user executes a query which takes a long time to return (difficult query with subselects etc.). My problem is when the query is executing I would like to check from the quering process the connection status of thje client. So is it still alive , or is the connection aborted. Anyone has any ideas how to accomplish this ?
Thanks in advance,
Marco Laponder
mlr AT interchain DOT nl
ODBC Call & connection status
Moderator: General Moderators
http://www.php.net/manual/en/features.c ... ndling.php describes what php offers in this matter
I am famliar with the link you gave me. The problem is during the expensive ODBC call I cannot execute the PHP script. So I would like to call from my own odbc driver the function connection_status() or check if the client is alive in an other way. As far as I can see now I can only check when I returned from the ODBC call but that means an expensive ODBC call is processed even if the user canceled the request.
Kind regards,
Marco Laponder
mlr@interchain.nl
Kind regards,
Marco Laponder
mlr@interchain.nl
It is an odbc driver and not an extension. If I wrote a extension instead of a driver could I check the connection status in that option ? (I have no experience on creating extensions). When I create an extension am I defining my own php functions ?
Kind regards,
Marco Laponder
mlr AT interchain DOT nl
Kind regards,
Marco Laponder
mlr AT interchain DOT nl
right, take a look at http://www.php.net/manual/en/zend.php
php_odbc itself is an extension (for win32 it's a.. eh... built-in extension
) so have a read of this module's source, too.
php_odbc itself is an extension (for win32 it's a.. eh... built-in extension
Just a couple of another questions (I am a newbi at extensions so please be patient).
How could I check from my own extension (say my_checkstatus_odbc_fetch() ) the connection status ? Could I call any php function for that ? Any idea when the connection status is updated ?
TIA
Marco Laponder
mlr AT interchain DOT nl
How could I check from my own extension (say my_checkstatus_odbc_fetch() ) the connection status ? Could I call any php function for that ? Any idea when the connection status is updated ?
TIA
Marco Laponder
mlr AT interchain DOT nl
Yes, you can call any function, Chapter 38. Calling User Functions describes it
But getting the connection status might be easier. Take a look at the implementions of connection_aborted() and connection_status()PG(v) is defined asso it's simply fetching an entry from a global table.
But I can't tell you when this is updated, I not that familiar with the php-source in general and extensions in particular
But getting the connection status might be easier. Take a look at the implementions of connection_aborted() and connection_status()
Code: Select all
/* {{{ proto int connection_aborted(void)
Returns true if client disconnected */
PHP_FUNCTION(connection_aborted)
{
RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
}
/* }}} */
/* {{{ proto int connection_status(void)
Returns the connection status bitfield */
PHP_FUNCTION(connection_status)
{
RETURN_LONG(PG(connection_status));
}
/* }}} */Code: Select all
# define PG(v) TSRMG(core_globals_id, php_core_globals *, v)But I can't tell you when this is updated, I not that familiar with the php-source in general and extensions in particular