[TYPO3-dev] Update database when saving plugin flexform configuration in BE?

JoH asenau info at cybercraft.de
Thu Sep 10 11:05:47 CEST 2009


>> A loop doubles the number of function calls in case you only want
>> one row, since you have to call sql_fetch_assoc at least twice
>> within the while loop to get back FALSE for the missing second row.
>> Even if we are just talking about values < 1ms here, they will sum
>> up to a significant value in the end, which is even more
>> significant, in case we just want to deliver a page from cache,
>> which would have been possible within just a few milliseconds.
>>
>> Got the point?
>
> don't misunderstand me, i'm for all optimations in the API. But the
> "normal" devs should use the API in extensions to be save. I've seen
> extensions where devs make there own low level MySQL calls and that
> shouldn't be the case.
> So we have to differentiate: developers have to use the API, core devs
> should optimize APIs and core.

Of course, and I didn't doubt that in any way.

But there is a difference between:

list($row) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pi_flexform',
'tt_content', 'uid=' . $id, '', '', 1);

and

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pi_flexform', 'tt_content',
'uid=' . $id, '', '', 1);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$GLOBALS['TYPO3_DB']->sql_free_result($res);

both use API functions, but as Dmitry already pointed out, people might
forget the last function call.
And since he wants to keep his code clean and lean, I thought it would be a
good idea to put all three calls into one API function.

Just my single row ;-)

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com
TYPO3 workshops: http://workshops.eqony.com






More information about the TYPO3-dev mailing list