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

Hello:

I'm trying to sort a TBufferDataset by several criteria, and I'm a little confused.

There is no sort method, so I decided to use indexes, but I have a lot of doubts.

When you close the TBufferDataset, all the data is cleaned.

Correct.


TbufferDataset has a MaxIndexesCount that limits the number of indexes. By default this property is intialized to 2, and two indexes are created and used by default as soon as you call addIndex. So you must call addIndex before opening the table, or set MaxIndexesCount to at least 3 in order to be able to add an index with the table active. (you can't close the table to add new index or you'll lost data).

Correct.


There is no way to drop a single index, and there is no way to change the index fields on the fly, you must call clearIndexes. And to call clearIndexes, before you must close the dataset, and so loose data. Am I right?

Yes.

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.

By the way, What does the index option "ixNonMaintained" mean?

I don't think it is used in FPC, I think it's a Delphi compatibility option.

Michael.
--
_______________________________________________
lazarus mailing list
[email protected]
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to