Print Thread
Question on 'ReadBuffer' property.
#1263 11/14/00 10:34 PM
Joined: Nov 2000
Posts: 19
Montreal, Canada
J
Member
OP Offline
Member
J
Joined: Nov 2000
Posts: 19
Montreal, Canada
I set the QueryAllRecords property of a TOracleDataSet to false, and its ReadBuffer property to 5. Then I linked a TDBGrid (through a TDataSource) to the OracleDataSet. The grid is able to display 50 records at a time.

When the connection to the database is activated (at runtime), the grid displays 50 records (not five). Does that mean that the ability of the grid to display 50 records overrides the 'ReadBuffer' property? How can I get assured that only 5 records at a time will be fetched from the database when the user scrolls through the grid?

Re: Question on 'ReadBuffer' property.
#1264 11/15/00 12:50 AM
Joined: Nov 1999
Posts: 108
Bod
Member
Offline
Member
Joined: Nov 1999
Posts: 108
Bod
New records will always be fetched to the client whenever the application requests them. This can be done programmatically (calling next, locate, last etc). When using a dbgrid, the grid will request as many records as it needs to fill in all visible rows in the form. I.e. if the grid initially is able to display 12 rows, it will do three fetches at once when you initiate the form (assuming the ReadBuffer is set to 5). It will continue fetching new rows whenever the user scrolls the grid.

So if you are using a grid that can show more than five rows at a time, I would think that increasing the ReadBuffer value gives you a better result. This leads to fewer network roundtrips back and forth getting your data.

Beware of long and lob fields, however, including such fields will lead to fetching just one row at a time.

Re: Question on 'ReadBuffer' property.
#1265 11/15/00 01:44 AM
Joined: Nov 2000
Posts: 19
Montreal, Canada
J
Member
OP Offline
Member
J
Joined: Nov 2000
Posts: 19
Montreal, Canada
Thank you for your concise answer. It neatly clears this issue for me.

Now, another (related) question: Let's suppose QueyAllRecords is set to false, and ReadBuffer=5 again. The dbGrid displays 5 rows at a time. Thus, after opening the dataSet 5 rows are fetched and displayed out of 100,000. If LAST is called, will only the last 5 rows of the table be fetched, or will ALL 100,000 records be fetched at once to allow displaying the 5 last ones?

Thanks again for your attention,
Jean-Paul

Re: Question on 'ReadBuffer' property.
#1266 11/16/00 03:27 PM
Joined: Sep 1999
Posts: 27
Germany
K
Member
Offline
Member
K
Joined: Sep 1999
Posts: 27
Germany
I think (but not really know) that calling LAST will only fetch the last few records of the table. All other behavior won't make sense ...

Oliver


Oliver Kaesmann
Re: Question on 'ReadBuffer' property.
#1267 11/16/00 09:10 PM
Joined: Aug 1999
Posts: 22,221
Member
Offline
Member
Joined: Aug 1999
Posts: 22,221
No, all 100,000 records will be fetched. The TOracleDataSet cannot determine which 5 records are last without finishing the query. You should avoid such queries, and use explicit SQL statements to find specific records. Nobody needs 100,000 records in a grid [Linked Image] .

------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: Question on 'ReadBuffer' property.
#1268 11/16/00 10:13 PM
Joined: Nov 2000
Posts: 19
Montreal, Canada
J
Member
OP Offline
Member
J
Joined: Nov 2000
Posts: 19
Montreal, Canada
Thank you all for your help. I'll stick with my WHERE clause in the SQL statement then!

Jean-Paul


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.043s Queries: 13 (0.009s) Memory: 2.5204 MB (Peak: 3.0430 MB) Data Comp: Off Server Time: 2024-05-20 11:23:34 UTC
Valid HTML 5 and Valid CSS