Board index » delphi » How Can I do an Sql Query little by little ?

How Can I do an Sql Query little by little ?

Hi, My question is, in delphi when you do the instruction   query.Open;
it's executes all query and after that it returns, I want to know how can I
do the Query for the first 100 rows,  make a pause, rest a little and then
do the next 100 rows, and so on, not to wait until it has the complete rows
calculated.
Thank You.
 

Re:How Can I do an Sql Query little by little ?


Quote
"Raul Trasvina" <rtr...@yahoo.com> wrote in message news:3d018616_2@dnews...
> Hi, My question is, in delphi when you do the instruction   query.Open;
> it's executes all query and after that it returns, I want to know how can
I
> do the Query for the first 100 rows,  make a pause, rest a little and then
> do the next 100 rows, and so on, not to wait until it has the complete
rows
> calculated.

Query components do not fetch all records back at once unless you do
something to cause that. By default it will only fetch the 1st record back,
or the first n where n is the number of visible rows in an attached grid.

If all records are being fetched, this could be because of some code you've
placed in an event that does a RecordCount, Last, Locate, or you have
specified a Filter property and/or OnFilterRecord event.

--
Wayne Niddery (Logic Fundamentals, Inc.)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
Those who disdain wealth as a worthy goal for an individual or a society
seem not to realize that wealth is the only thing that can prevent
poverty. - Thomas Sowell

Re:How Can I do an Sql Query little by little ?


Hi, mister Niddery,  first thing I am using Query:TQuery; and the tables are
Paradox tables.
I create a Table with 200,000 records, I trace the next code :
        query1.sql.text:='select   *   from    Table1';
        query1.RequestLive:=false; {Trying to consider the general case}
        query1.open;
        query1.last;

and when  I do the query1.Open; it spend a lot of time; and when I do the
query1.last it doit very fast so
I thing it generates all the record in the Open operation.

Second question :
When I use query1.requestLive:=true the open operation its very fast I think
it's because it doesn't generate
anything it just use the original table,  and that's ok, but when I do a
query1.next operation it spend to much time, 1 or 2 seconds,  the situation
is the opossite of the first case, Open too slow-NextFast;  and the second
OpenFast-Next too slow.

Re:How Can I do an Sql Query little by little ?


This newsgroup is for SQL database servers. Paradox questions should
be asked  in the database.desktop newsgroup. Because you posted to the
wrong group Wayne assumed that you are using a database server.

Running a SELECT query on a Paradox table with no WHERE clause causes
the entire table to be read across the network and scanned
sequentially to build the result set. That is the reason for the long
delay. If you want to scan the whole table you well get better
performance using a TTable.

On Sun, 9 Jun 2002 03:06:14 -0700, "Raul  Trasvina" <rtr...@yahoo.com>
wrote:

Quote
>Hi, mister Niddery,  first thing I am using Query:TQuery; and the tables are
>Paradox tables.
>I create a Table with 200,000 records, I trace the next code :
>        query1.sql.text:='select   *   from    Table1';
>        query1.RequestLive:=false; {Trying to consider the general case}
>        query1.open;
>        query1.last;

>and when  I do the query1.Open; it spend a lot of time; and when I do the
>query1.last it doit very fast so
>I thing it generates all the record in the Open operation.

>Second question :
>When I use query1.requestLive:=true the open operation its very fast I think
>it's because it doesn't generate
>anything it just use the original table,  and that's ok, but when I do a
>query1.next operation it spend to much time, 1 or 2 seconds,  the situation
>is the opossite of the first case, Open too slow-NextFast;  and the second
>OpenFast-Next too slow.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Other Threads