Re: paging
From: Anders Altberg (x_pragma_at_telia.com)
Date: 08/23/04
- Previous message: Anders Altberg: "Re: paging"
- Maybe in reply to: jorge: "paging"
- Next in thread: Anders Altberg: "Re: paging"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Aug 2004 20:52:59 +0200
"[VFP] can only order after it has the full resultset." Ever heard of
Rushmore? <g>.
-Anders
"Olaf Doschke" <T2xhZi5Eb3NjaGtlQFNldG1pY3MuZGU@strconv.14> wrote in message
news:eH8G2JTiEHA.3928@TK2MSFTNGP11.phx.gbl...
> > select generateKey() as NewKey, * from table
> > where cCondition
> > order by cOrder
> > group by cGroup
> > having between ( NewKey, FirstRecordOfPage,
> > FirstRecordofPage+ItemsPerPage )
> Well, foxpro would work with such a select,
> but using Having, will filter _after_ the resultset
> is loaded over the (Ether)net, which is one
> disadvantage.
>
> Nevertheless:
> You just need generateKey() to be a known
> function in the scope of the select, which could
> be globally done with a
> SET PROCEDURE TO Yourfunctions.prg
> somewhere at the beginning of an app.
>
> But my test shows: Order By is done late,
> after generateKey() has already generated
> the same Recno() already gave us...
>
> Well foxpro is no database server, it's a file
> based database. So it can only order after
> it has the full resultset. A real db server would
> do the same, but only send the first record
> over the net, when it has finished with ordering...
>
> One solution could be: Having an index with
> the sorting order you need, use this kind
> of pseudocode:
>
> create cursor resultcursor
> select 0
> use table in 0 order tagname
> locate .t. (faster than go top)
> skip nPages*nPagelength
> nCount = 0
> scan rest
> if nCount>=nPagelength
> exit
> else
> <copyrecord to resultcursor>
> endif
>
> nCount = nCount +1
> endscan
>
> a copy of a single record can be done
> with scatter/gather.
>
> skip nPages*nPagelength is risky!
> You'd have to make sure, this wont
> skip too far (reccount() may help, but
> it counts deleted records too!).
>
> This is complicated, but the way to go
> with a file based database. I think it's the
> reason, why something like LIMIT isn't
> implemented in Foxpro, and why you
> don't see something like paging in foxpro
> desktop applications.
>
> web applications are another thing: There
> it would be okay to first select all and then
> create a html page with a certain
> "data page"...
>
> Bye, Olaf.
>
>
- Previous message: Anders Altberg: "Re: paging"
- Maybe in reply to: jorge: "paging"
- Next in thread: Anders Altberg: "Re: paging"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|