[redland-dev] librdf and mysql connections?

Peter van Heusden pvh at sanbi.ac.za
Mon Jun 11 15:35:25 BST 2007


Hi

I have inherited a previous programmer's php-librdf code, and it seems 
(at least with redland 1.0.6 on gentoo) to be producing vast numbers of 
mysql connections that are never terminated. Specifically, the following 
query fragment:

    function query($sQuery) {
        // Execute RDQL query on Redland RDF model

        $oNullUri =& librdf_new_uri($this->oWorld,"");
        // ^ No need to free since it is null.

        $oQuery =& librdf_new_query(
                        $this->oWorld,"rdql",$oNullUri,$sQuery,$oNullUri
                   );
        $oResult =& librdf_query_execute($oQuery,$this->oModel);

        librdf_free_query($oQuery);

        return $oResult;
    }

seems to be the culprit - each time librdf_new_query is called, a mysql 
connection is opened. That connection remains open indefinitely. As a 
result idle mysql connections pile up. I'm not sure if the problem is 
redland being used with the wrong idiom, or if the problem is with 
redland. How can I get to either re-use the same mysql connection, or 
close it timeously?

Thanks,
Peter
SANBI - South Africa



More information about the redland-dev mailing list