Subject Re: [firebird-support] Re: is it possible?
Author Lester Caine
Gediminas wrote:

> suppose there is the initial set:
> 1 2 3 4 5 6 7 8 9 10 11 12
> first call:
> 1 10 4 9 8 11 2 6 12 5 7 3
> second call:
> 6 9 10 3 1 7 11 2 4 8 12 5
> and so on

This would probably happen anyway, if you have updated some of the
records and are only using 'natural' order.

>>>using SP, UDF or other FB 1.5 features need to implement function,
>>>which randomly orders dataset (get from the select statement) using
>>>iterative algorithm (actually, every function call reorders element
>>>position in the set).

The elements are never reordered, only the order that the RESULTS are
displayed in changes, depending on ORDER BY and filters.

>>>As I know, the FB doesn't have set or list containers as in the STL.
>>>Is it possible to use table as a temporary container, but if several
>>>concurent calls to such function would occur?

If you want to DISPLAY things in a random order, then your client would
handle that, an number of the php applications display random page
lists, these just call single records and 'throws the dice again' if a
page has already been added to the list.

If you want to create a table with random order, you need a base table
with a fixed order column - 1 to 12, and a second column into which you
'throw the dice'. Then you can use that table with a join to the real
data. But with current setup, it needs to be a real table, rather than a
temporary one ;)

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services