[TYPO3-core] RFC: minor optimisation of getRecordRaw()
Martin.Kutschker at n0spam-blackbox.net
Fri Dec 1 09:45:14 CET 2006
Dmitry Dulepov schrieb:
> Martin Kutschker wrote:
>> I noticed that t3lib_BEfunc::getRecordRaw() does not free the SQL
>> result. While changing that I have also added a LIMIT to the query as
>> only the first found record is used.
> Good idea but I see a possibility for PHP errors here:
>> + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields,
>> $table, $where, '', '', '1');
>> + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
> Second line will produce PHP error if first line does not return proper
> result set.
In know. I didn't change that because the original code lacked the check.
In fact no TYPO3 code ever checks for a SQL result.
> This would also take care about Franz's comment. $row on the first line
> can also be set to false, which will not be 100% identical to previous
> behavior but will look nicer and will be fully compatible with existing
Fine with me, but we should define whether we want NULL (your suggestion)
or FALSE (usual PHP behaviour) for array returning functions.
More information about the TYPO3-team-core