Packet Fetches


 

AstaClientDatasets can be set to Open a Server side cursor and return RowsToReturn number of rows. In this way large queries can be more efficiently fetched over latent lines. In order to use this technique the ASTA server must be running in PersistentSessions threading model which requires each remote client to have their own Database Session. Although this technique is useful, the AstaServer will not scale as well as when it is run using the recommended Pooled Threading Model.

 

When RowsToReturn is set to -1 all rows are returned. When RowsToReturn is set to 0 only the FieldDefs are returned and an empty DataSet is returned. This may be useful when only inserted rows are required.

 

The AstaClientDataSet.SQLOption of soPackets must be set to true to enable Packet Fetches. When the initial select is executed on the server, RowsToReturn number or rows are returned. To retrieve subsequent rows, you must call GetNextPacket. There is an AutoFetchPackets property on the AstaClientDataSet that if set to true, will attempt to call GetNextPacket if any Visual Controls are connected to the DataSet like a TDBGrid.

 

When the AstaClientDataSet is closed CloseQueryOnServer is called to close the TDataSet component used on the server for the select. You may also call CloseQueryOnServer directly if you want to close the server side TDataSet. The component used for this is determined by a server side call to ThreadedDBSupplyQuery which must be coded to dynamically create a TDataSet for a client packet fetch request.

 

After a Packet Fetches is executed you may also then do a GetNextPacketLocate which executes a server side Locate call on the open TDataSet on the server. Performance will depend on the size of the result set and how the Locate is implemented by your server side component. File server components like DBISAM can use indexes on locates so performance can be quite fast. For client/server databases indexes are not available on result sets so server side locates would have to iterate sequentially through the DataSet so large result sets may not result in fast results.

 

 

 

 



ASTA Overview