Clear dataset
Moderators: gto, cipto_kh, EgonHugeist
-
- Fresh Boarder
- Posts: 7
- Joined: 19.09.2006, 16:04
- Location: Rio do Sul, SC
Clear dataset
Necessary to make with that one result set can be clean without query either closed.
That is I have an instruction SQL that has 1000 rows and am reading (query.next). When to reach 100 records I want to continue reading but I want that the 100 read records already are eliminated of resultset.
Thanks.
That is I have an instruction SQL that has 1000 rows and am reading (query.next). When to reach 100 records I want to continue reading but I want that the 100 read records already are eliminated of resultset.
Thanks.
More ways to do that:
a) via SQL:
(more on http://dev.mysql.com/doc/refman/5.1/en/select.html)
b) via cached datasets. Make the property Query.CachedUpdates := true and then Query.Delete without affecting the "real" database table. After you finished just call Query.CancelUpdates or close a dataset withou posting the changes (this is done with Query.ApplyUpdates then Query.CommitUpdates) - read the Delphi help for more.
c) Try to use a more efficent way, I suggest you to process as much as you can on the server (more SQLs, if possible stored procedures, .. etc.)
a) via SQL:
Code: Select all
Select * from Table limit 0,100
Select * from limit 100,100
Select * from limit 200,100
...
b) via cached datasets. Make the property Query.CachedUpdates := true and then Query.Delete without affecting the "real" database table. After you finished just call Query.CancelUpdates or close a dataset withou posting the changes (this is done with Query.ApplyUpdates then Query.CommitUpdates) - read the Delphi help for more.
c) Try to use a more efficent way, I suggest you to process as much as you can on the server (more SQLs, if possible stored procedures, .. etc.)
-
- Fresh Boarder
- Posts: 7
- Joined: 19.09.2006, 16:04
- Location: Rio do Sul, SC
I´m using ORACLE
I go to try way SQL. But I am using ORACLE and the functions are a little different.
But Thanks.
But Thanks.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact:
This is a tricky problem, and in most times can be fixed with a better system design, like using limits (MySQL) and first (Firebird).
About limiting resultset to certain records on oracle, take a look here:
http://blog.dataloss.nl/perma/oracle-limit
http://edocs.bea.com/workshop/docs81/do ... index.html
http://forum.java.sun.com/thread.jspa?t ... ID=3233484
About CDS, take a look here:
It's a marvelous component, but should be used with care
About limiting resultset to certain records on oracle, take a look here:
http://blog.dataloss.nl/perma/oracle-limit
http://edocs.bea.com/workshop/docs81/do ... index.html
http://forum.java.sun.com/thread.jspa?t ... ID=3233484
About CDS, take a look here:
http://podgoretsky.com/ftp/Docs/Delphi/D5/dg/5_ds3.htmlApplications that need to represent extremely large read-only datasets can turn off FetchOnDemand to ensure that the client datasets do not try to load more data than can fit into memory. Between fetches, the client dataset frees its cache using the EmptyDataSet method. This approach, however, does not work well when the client must post updates to the application server.
It's a marvelous component, but should be used with care
-
- Fresh Boarder
- Posts: 7
- Joined: 19.09.2006, 16:04
- Location: Rio do Sul, SC
My problem is the following one: I have one query (ZReadOnlyQuery) that he prossess a command SQL that returns many rows (200000). Then if I to make readings with paging I finish very being slow at certain moment. If not I as the reading happens the program goes consuming CPU resources until the point where the Windows accuses memory low, the computer stops.
The Correct one would not be to more paging but clean the resultset of query that already it was read so that the memory is set free.
The Correct one would not be to more paging but clean the resultset of query that already it was read so that the memory is set free.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact:
I propose 2 solution about this problem.
First, you can use both TClientDataSet and TDataSetProvider. Set DataSet property of TDataSetProvider to your ZTable or ZQuery, and then set ProviderName property of TClientDataSet to the such TDataSetProvider.
now you your TClientDataSet ready to use. The point is, if you use TClientDataSet, you can clear your dataset becouse TClientDataSet has EmptyDataSet procedure.
Second, I have posted the new features of zeoslib which cotain EmptyDataSet procedure (like TClientDataSet). with the new LIB you don't need TClientDataSet anymore. you can download it from this forum at Subject "New ZeodLib: How To Post?" or you can wait for the moment until new SVN released.
Thanx.
First, you can use both TClientDataSet and TDataSetProvider. Set DataSet property of TDataSetProvider to your ZTable or ZQuery, and then set ProviderName property of TClientDataSet to the such TDataSetProvider.
now you your TClientDataSet ready to use. The point is, if you use TClientDataSet, you can clear your dataset becouse TClientDataSet has EmptyDataSet procedure.
Second, I have posted the new features of zeoslib which cotain EmptyDataSet procedure (like TClientDataSet). with the new LIB you don't need TClientDataSet anymore. you can download it from this forum at Subject "New ZeodLib: How To Post?" or you can wait for the moment until new SVN released.
Thanx.
-
- Fresh Boarder
- Posts: 7
- Joined: 19.09.2006, 16:04
- Location: Rio do Sul, SC
Memory continues High
OK.
I made the Download of units and functioned the EmptyDataSet. But I continue with a problem, the memory used for the operational system (win XP) for the application is not lowering when the EmptyDataSet is executed.
This is normal?
Thanks.
I made the Download of units and functioned the EmptyDataSet. But I continue with a problem, the memory used for the operational system (win XP) for the application is not lowering when the EmptyDataSet is executed.
This is normal?
Thanks.
-
- Senior Boarder
- Posts: 50
- Joined: 31.08.2006, 10:41
- Contact: