Board index » off-topic » How to prevent mass-fetching
viana
Delphi Developer |
How to prevent mass-fetching2006-12-16 02:41:07 AM off-topic17 Hello, Here is my problem. An user opens a screen with a DBgrid, connected to a Clientdataset that is connected to a SocketConnection. The Clientdataset is connected to a DatasetProvider. The Clientdataset fetchs only 25 record first, and will fetch more as the users move the dbgrid's scroll down (PacketRecords is 25). The problem : if the user moves the vertical scroll completely down, ALL records will be fetched. This is a serious problem because we have tables with more than one-million records. So when it happens, the server goes to 100% Cpu-usage and the only way to solve is to restart the server. I know that is possible to disable the vertical scroll. I also know that is better to force the user to make a filter and do a SQL statement with less records. But what i'd like to do is to control the fetching. For example, if the number of records fetched is greater than 10,000, i will prompt a message asking the user if he wants to proceed. I tried the BeforeGetRecords event, but this event is not called in every 25 records ; if the user scrolls all bottom, then this event is called only once. Any ideas would be very appreciated. Thanks, Viana |