Re: pager

[prev] [thread] [next] [Date index for 2004/10/22]

From: Emanuele Zeppieri
Subject: Re: pager
Date: 12:21 on 22 Oct 2004
From: David R. Baird [mailto:dave@xxxxxxxxxxxxx.xx.xx]=20
Sent: Friday, October 22, 2004 11:20 AM
To: cdbi-talk@xxxxxx.xxxxx.xxx
Subject: Re: pager

> OK, that would be good, but now I need to know which databases use=20
> which syntax. Any info gratefully received. But I suppose these can=20
> be added over time. At the moment all I know is Postgre, MySQL, and=20
> InterBase/FireBase. I suspect various other databases use the same=20
> syntax as one of these. And I think both MySQL and Postgre changed=20
> their LIMIT syntax in fairly recent versions, I'm sure I can track=20
> that down.=20

Cross DB servers LIMIT/OFFSET support can really be very intricate.
Some DBMSs use a completely different sintax for the LIMIT clause and
don't offer any kind of OFFSET clause (most noticeable MS Access and MS
SQL Server,) therefore you have to simulate it in some way, usually
wrapping your original query with extra SELECTs.
In MS Access for example, to add LIMIT/OFFSET to this query:

SELECT my_column
FROM my_table
ORDER BY my_column ASC

say with the values LIMIT=3D5 OFFSET=3D10, you have to resort to the TOP
clause and re-write it this way:

SELECT * FROM (
	SELECT TOP 5 * FROM (
		SELECT TOP 15 my_column
		FROM my_table
		ORDER BY my_column ASC
	) AS foo ORDER BY my_column DESC
) AS bar ORDER BY my_column ASC

(the innermost TOP clause takes the value 15=3D5+10.)
To sum up, be ware that you won't find just slight sintactic differences
like that between MySQL and Postgres, if you really want to support any
DB server.

Cheers,
Emanuele Zeppieri.

(message missing)

pager
David R. Baird 09:48 on 20 Oct 2004

Re: pager
David R. Baird 13:53 on 20 Oct 2004

Re: pager
David R. Baird 21:00 on 20 Oct 2004

Re: pager
merlyn (Randal L. Schwartz) 02:55 on 21 Oct 2004

Re: pager
David R. Baird 10:46 on 21 Oct 2004

Re: pager
David R. Baird 11:30 on 21 Oct 2004

Re: pager
merlyn (Randal L. Schwartz) 12:10 on 21 Oct 2004

Re: pager
David R. Baird 23:08 on 21 Oct 2004

Re: pager
Cees Hek 00:22 on 22 Oct 2004

Re: pager
Tony Bowden 08:34 on 22 Oct 2004

Re: pager
Emanuele Zeppieri 13:51 on 22 Oct 2004

Re: pager
David R. Baird 14:41 on 22 Oct 2004

Re: pager
David R. Baird 09:20 on 22 Oct 2004

Class::DBI modules not properly loaded under mod_perl ?
Michele Valzelli 10:55 on 22 Oct 2004

Re: pager
Emanuele Zeppieri 12:21 on 22 Oct 2004

Re: pager
David R. Baird 12:52 on 22 Oct 2004

Re: pager
Emanuele Zeppieri 15:33 on 22 Oct 2004

Re: pager
David R. Baird 16:09 on 22 Oct 2004

Re: pager
David R. Baird 23:30 on 07 Nov 2004

RE: pager
Emanuele Zeppieri 03:50 on 14 Nov 2004

Re: pager
Emanuele Zeppieri 13:25 on 22 Oct 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52