Hi everyone, I'm working on an extension for an RDF triple store that is built on top of MySQL 5+, and I'd like to be able to share the MySQL connection with mysqli. Unfortunately, since the mysqli header isn't installed, I can't seem to find a way that could withstand changes in mysqli.
What I've come up with is to create a trivial function which will take a (zval *) and return a (MYSQL *). I know it's a bit of a hack, but I was trying to be as unintrusive as possible. Patch is attached. -Evan Nemerson
Index: mysqli.c =================================================================== RCS file: /repository/php-src/ext/mysqli/mysqli.c,v retrieving revision 1.97 diff -u -r1.97 mysqli.c --- mysqli.c 27 Jul 2006 10:53:03 -0000 1.97 +++ mysqli.c 2 Sep 2006 07:10:52 -0000 @@ -331,6 +331,16 @@ } /* }}} */ +/* {{{ MYSQL * mysqli_get_connection(zval *mysql_link TSRMLS_DC) */ +MYSQL * mysqli_get_connection(zval *mysql_link, INTERNAL_FUNCTION_PARAMETERS) { + MY_MYSQL *mysql; + + MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID); + + return mysql->mysql; +} +/* }}} */ + static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC) { mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php