Re: [MRBS-general] A couple of MySQL fixes in functions_mail.inc
Brought to you by:
jberanek
From: Michael S. <ms...@cb...> - 2004-05-11 13:22:10
|
On Tue, 11 May 2004, Thierry Bothorel wrote: > Your bug seems strange to me because I know that I let the repeat table > into the FROM statement, but in my case it is harmless, it does not prevent > the query to run, as much as this table is removed from the SELECT > statement. I use almost the same mysql version as you (4.0.13). If this is a > problem, I will include it conditionaly also. > Do you use the last version of function_mail (1.5) ? I was using 1.4, looks like my checkout was a few hours before your commit. I updated to 1.6 and this problem (mrbs_repeat in FROM clause) went away (looks like you committed the patch though, maybe that's why :) > On this I am believe again you do not use the latest version, as I > experienced this bug before, or the bug is caused by another problem. > sql_free soulf always works, even if there is no data (you don' t supply > emails addresses). sql_row() always return an array, and then you can free > the result set. If not, then it was the previous query that was faulty. It looks to me like the query is correct - if I save it and run it after the fact, it produces one row, with NULL as the area admin. Not sure whether the event ID exists at the time of the query, but it looks like it should, and even if it doesn't, MySQL just returns an empty result set. But I still get the sql_free() error. I'm using MySQL 4.0.15 and php 4.3.3. This patch works around it: --- functions_mail.inc 11 May 2004 05:00:16 -0000 1.6 +++ functions_mail.inc 11 May 2004 12:44:59 -0000 @@ -117,7 +117,10 @@ $res = sql_query($sql); (! $res) ? fatal_error(0, sql_error()) : ''; $row = sql_row($res, 0); - sql_free($res); + if ($row != 0) + { + sql_free($res); + } if ( empty($recipients) && (NULL != $row[0]) ) { $recipients .= $row[0]; Mike |