Memory allocation in PHP

From: Date: Mon, 10 Jul 2000 15:44:28 +0000
Subject: Memory allocation in PHP
Groups: php.dev 
Request: Send a blank email to php-dev+get-24089@lists.php.net to get a copy of this message
Hallo, I am working on the implementation of simple subselects in PHP for use with MySQL. The code is crappy at the moment, but it works for now. Now I've a little problem with memory allocation: In the function PHP_FUNCTION(mysql_ext_query) (which is a derrivate of PHP_FUNCTION(mysql_query)) I am calling a function which goal is to rewrite the subselect to a normal query, i.e.: SELECT * from Mededelingen WHERE mdlID NOT IN (SELECT mglID FROM MededelingenGelezen) to: SELECT * from Mededelingen WHERE NOT (mdlID = 3 OR mdlID = 5 OR mdlID = 8) the function I wrote must rewrite (*query)->value.str.val : (From mysql_ext_query) // Copied from mysql_query: ZEND_FETCH_RESOURCE2 (mysql, MYSQL *, mysql_link, id, "MySQL-Link", le_link, le_plink); convert_to_string_ex (query); // Her I call my homemade function: mysql_scan_for_subselect (mysql, (*query)->value.str.val); // Copied from mysql_query: #if MYSQl_VERSION_ID > 32199 if (mysql_real_query (*query)->value.str.val, (*query)->value.str.len)!=0) { RETURN_FALSE; } #else How can I safely create (allocate) a string in the function mysql_scan_for_subselect that can be used in the mysql_real_query function call, without messing up something? With kind regards, Derick Rethans JDI Media Solutions H.v.Tussenbroekstraat 1 6952 BL Dieren The Netherlands e-mail: d.rethans@jdimedia.nl http://www.jdimedia.nl/

« previous php.dev (#24089) next »