[TYPO3-core] Fix for "debug_check_recordset" in t3lib_db
    Martin Kutschker 
    Martin.Kutschker at n0spam-blackbox.net
       
    Thu Sep  6 08:47:07 CEST 2007
    
    
  
Bernhard Kraft schrieb:
> Hallo !
> 
> 
> This is a SVN patch request.
> 
> Branch: Trunk
> 
> Problem:
> In class.t3lib_db.php there is a new method introduced which performs 
> checks if the result-resource variable which is used for fetching rows (using 
> ->sql_fetch_assoc and similar) is checked if it is set.
> Even if the variable contains for example a numeric "1" the check would 
> not fail and would give a mysql-error afterwards.
If you really want to have a strict check for the resource, the check 
shouldn't be in a debug fuction.
debug_check_recordset() tells the caller if there is a problem (it returns 
FALSE), yet this is not even used.
eg
function sql_fetch_row($res)    {
   $this->debug_check_recordset($res);
   return mysql_fetch_row($res);
}
This should, if we want to be save, more like that
function sql_fetch_row($res)    {
   if ($this->check_mysql_result($res)) {
     return mysql_fetch_row($res);
   } else {
     return FALSE;
   }
}
> Additionaly the query which failed isn't logged to devLog - which would 
> (in my opinion) be another good feature helping debug.
This may or may not be the query that caused the problem. The functions may 
be called in a wrong order or none of the query building functions could be 
involved. The class lacks a lastQueryUsed varaiable. *
Masi
* In fact the class needs to be split up: connection/utilities, query, result.
    
    
More information about the TYPO3-team-core
mailing list