RE: [PHP] Module writing question: Sharing resources between modules

From: Date: Tue, 19 Jun 2001 07:10:10 +0000
Subject: RE: [PHP] Module writing question: Sharing resources between modules
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54339@lists.php.net to get a copy of this message
Not entirely sure whats wrong with parsing a link to a function, it works fine for me. But why not make it tidy and write a simple class to incorporate an abstracted database layer, and then parse the class handler to the function? Ray Hilton - me@rayh.co.uk http://rayh.co.uk -----Original Message----- From: Yermo M. Lamers [mailto:yml@dtlink.com] Sent: 16 June 2001 21:07 To: php-general@lists.php.net Subject: [PHP] Module writing question: Sharing resources between modules I would like to port some Mysql code I have over to a PHP module. 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 doesn't seem to be a 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? I want to be able to do queries on an already opened connection? 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 ---------------------------------------------------------------------

« previous php.general (#54339) next »