Module writing question: Sharing Resources between separate modules.
| From: | Yermo M. Lamers | Date: | Sat, 16 Jun 2001 19:05:59 +0000 |
| Subject: | Module writing question: Sharing Resources between separate modules. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56916@lists.php.net to get a copy of this message | ||
I would like to write a PHP module that makes use of an already
established Mysql connection.
To make things clean, I'd like the exported functions from my new module
to accept MySQL-Link resources as in:
$mysql_conn = mysql_connect( .... );
my_custom_module_func( $mysql_conn );
From my reading of ext/mysql/php_mysql.c it looks like you need to have
access to the return code from zend_register_list_destructors_ex() in
order to be able to lookup the resource passed to you using
ZEND_FETCH_RESOURCE2().
In ext/mysql/php_mysql.c le_link and le_plink are declared static and
there's no clean way of getting at them to get the resources.
What am I missing?
How can can I get at the MYSQL * connection set up by the mysql module
from within my module?
Any pointers to sample code or information would be greatly appreciated,
thanks,
-- Yermo
---------------------------------------------------------------------
Try Personal Stock Monitor for Windows(tm) for FREE at:
http://www.personalstockmonitor.com
Powerful Desktop Software for Online Investors
---------------------------------------------------------------------