Show/Hide Toolbars

TMS Aurelius Documentation

You can provide objects to TAureliusDataset by using a query object cursor. This approach is especially useful when returning a large amount of data, since you don't need to load the whole object list first and then provide the whole list to the dataset. Only needed objects are fetched (for example, the objects being displayed in a TDBGrid that is linked to the dataset). Additional objects will only be fetched when needed, i.e, when you scroll down a TDBGrid, or call TDataset.Next method to retrieve the next record.

 

Note that the advantage of this approach is that it keeps an active connection and an active query to the database until all records are fetched (or dataset is closed).

 

To use a cursor to provide objects, just call SetSourceCursor method and pass the ICriteriaCursor interface you have obtained when opening a query using a cursor:

 

var

  Cursor: ICriteriaCursor;

begin

  Cursor := Manager.Find<TPerson>.Open;

  AureliusDataset1.SetSourceCursor(Cursor);

 

  // Or just this single line version:

  AureliusDataset1.SetSourceCursor(Manager.Find<TPerson>.Open);

 

You don't have to destroy the cursor, since it's an interface and is destroyed by reference counting. When the cursor is not needed anymore, dataset will destroy it.

 

When you call SetSourceCursor, the internal object list is cleared. When new objects are fetched, they are added to the internal list. So, the internal list will increase over time, as you navigate forward in the dataset fetching more records.