Subject Re: [IBO] Go straight to the nth record on a query's queue
Author Robert martin
Hi

Thats more of an SQL question but the answer is.


SELECT SKIP 20000
FROM ATable
WHERE SomeCondition
ORDER BY PK (or other)

Note you need to use an order by clause for the results to make sense.
If you are only interested in the first n records you can also use the
first command

SELECT FIRST 100 SKIP 20000
FROM ATable
WHERE SomeCondition
ORDER BY PK (or other)

Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com

Wild Software Ltd



Roberto Freitas wrote:
> I use Delphi 7, FireBird 1.5 and IBO4.
> Suppose a form containing:
> qrTable: TIB_Query;
> dsData: TIB_DataSource;
> qrTable.SQL.Text := SELECT * FROM ATABLE WHERE SOMECONDITION;
>
> Opening qrTable returns 30000 records. I dont't know actual physical
> places of these records in DataBase, but I can virtually imagine them
> one after the other in a big queue with 30000 elements.
> After opening the form, it quickly shows first record on screen. If I
> want to show the queue's element 20001 - which primary key value I
> don't know - the program does:
> with qrTable do begin
> DisableControls;
> MoveBy(20000);
> EnableControls;
> end;
> It wastes some time to do it: a "loading records" panel appear.
> My question is: is there any DataBase command or an IBO resource that
> make possible to go straight to the 20001th record ?
> (Please, good or bad programming techniques is not the subject here,
> because everything I write above is not real, but just a way to
> explain what I need, which is a way to go straight to the nth record
> on a query's queue when I don't know it's primary key value)
>
>
>
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>