[Lazarus] Sorting BufferDataset

Michael Van Canneyt michael at freepascal.org
Mon Apr 13 13:24:35 CEST 2020



On Mon, 13 Apr 2020, Santiago A. via lazarus wrote:

> El 13/4/20 a las 12:43, Michael Van Canneyt via lazarus escribió:
>>> So, if I want to process the dataset in different orders with 
>>> TbufferDataset, before opening the dataset I must set MaxIndexesCount to 
>>> all the orders I'm going to use.
>> 
>> Yes.
>> 
>>> 
>>> Am I right? Or I have missed something?
>> 
>> You are right.
>> 
>> Probably we should at least now offer the possibility to delete indexes, 
>> and
>> I am not sure the MaxIndexesCount is still needed. 
>
> At least it is used.
>
> If you create the indexes before opening the dataset, MaxIndexesCount is 
> automatically updated to hold your indexes plus the two default indexes.
>
> But in an active dataset, you can't call addindex more than MaxIndexesCount, 
> and being aware that two slots are used by two default indexes. You may get 
> "The maximum amount of indexes is reached."
>
> By the way. I got "The maximum amount of indexes is reached." and I went mad 
> trying to find where I was creating two indexes. Was I calling addindex 
> twices before and I wasn't aware?. Finally I looked at the code and when you 
> call addindex, it creates two indexes: 'DEFAULT_ORDER' and ''. What are those 
> two phantom indexes for? I couldn't find any documentation about

Default order is the index used for the records as they are read from the
file or from the query.

The other one is for when you set the indexfields property directly, I
think.

Michael.


More information about the lazarus mailing list