Subject Re: [IBO] Ordering / Sorting methodology
Author Jason Wharton
> Hi everyone,
> A question for those in the know....why is a change in the ordering of
> data within a grid achieved by reissuing the SQL to the server and
> downloading all the data again in the new order, rather than just applying
> the sorting algorithm to the grid control. If it were done the latter way,
> it seems it would be faster (no extra network traffic), and also easier to
> implement custom sorting algorithms. Or am I forgetting something?
>
> I'd like to sort data in columns using text suffixes, eg
> 82 pF
> 120 pF
> 0.1 nF
> 470 nF
> 1000 uF
> etc., which I could implement if there was a virtual '<' operator I could
> overload for the grids' sorting procedure.

One thing I plan to add into a later minor release of IBO v4 is just what
you are talking about here.

Why it is quite difficult is because InterBase has many collations it can
use and I don't have any idea just how complex it will be to accommodate all
of the different possibilities IB can do and accurately behave the same on
the client.

As far as the sorting part of it, IBO will have no trouble at all doing an
efficient sort since each row is a separate dynamic memory allocation
arrayed in a list of pointers. Is all I have to do is swap pointer values
around to implement the sort...

Also, keep in mind that any dataset so small that you already have all the
records in the buffer it probably isn't a big deal to refresh that dataset
anyway. Also, it is possible to set FetchWholeRows to false and in the case
that you are changing the sort of the records you only need to fetch the
keys and IBO will take care of caching the whole record buffers and marry
them back up with the keys as they come from the server in the new order.

Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com