[TYPO3-mvc] ORDER BY RAND()

Susanne Moog typo3 at susannemoog.de
Tue Mar 16 21:54:10 CET 2010


Hey Xavier,

Am 15.03.2010 07:17, schrieb Xavier Perseguers:
> Hi Susanne,
> 
>>> You might want to use shuffle($array) instead.
>>
>> that's what I'm currently doing, but it's not nice, as I have to fetch
>> all items first, then shuffle and then splice to get 10 random elements.
>> Performance wise at least it would certainly be faster with ORDER BY
>> RAND() LIMIT 0,10. What speaks against implementing it?
> 
> As far as I'm concerned (even if I'm not ;-), I would like Extbase to
> try to keep having official TYPO3 SQL being used. I mean SQL that may be
> parsed by t3lib_sqlparser in order to support other DBMS (even if it's
> still not being very well tested).

as you are into this topic far more than I am, would you mind telling me
what the best approach for getting something like RAND() would be? I
know that there are similar functions in at least postgre, mssql and
oracle, but I don't know anything about what needs to be observed when
implementing a function for it. I guess there is some kind of mapping?

Thanks in advance for enlightening me (and thanks for caring for other
DBMS ;)).

Susanne


More information about the TYPO3-project-typo3v4mvc mailing list