[TYPO3-core] RFC #13467: add getField() function to database API

Xavier Perseguers typo3 at perseguers.ch
Fri Apr 9 14:48:37 CEST 2010


Hi Ernesto,

> We could make a cooler "getRows()" alternative which returns an object
> that implements "Iterator" [1] and which internally does the
> sql_fetch_assoc, sql_data_seek etc.
>
> This would provide a much cleaner API, allowing stuff like:
>
>   $rows = DB->exec_SELECTgetRowsIterator(blabla);
>   foreach ($rows as $row) {
>      // do stuff
>   }
>
> without memory harm, as the foreach will fetch each "$row" on demand.
>
> Cheers,
> Ernesto
>
> [1] http://php.net/manual/de/language.oop5.iterations.php

I really like this idea.

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en


More information about the TYPO3-team-core mailing list