Re: adding LIMIT, OFFSET to CDBI::AbstractSearch and SQL::Abstract
[prev]
[thread]
[next]
[Date index for 2004/04/27]
Perhaps the developer could just write something like:
Class->search(a => "bla", b => "bla", { limit => "5 OFFSET 0" })
if he uses postgres and {limit => "5, 0"} if he uses mysql, so the class
code would be the same for all databases. Or would that go against some
principle of ClassDBI?
- Alexander
fliptop wrote:
>list
>
>i am wanting to implement a limit/offset clause similar to how order_by
>works w/ CDBI::AbstractSearch and SQL::Abstract. however, this is not
>supported in the same manner between databases. for example, in
>postgresql i'd use:
>
>SELECT cdid
>FROM music
>WHERE year = 1990
>ORDER BY title
>LIMIT 5 OFFSET 0
>
>but in mysql it'd be:
>
>SELECT cdid
>FROM music
>WHERE year = 1990
>ORDER BY title
>LIMIT 5, 0
>
>i'm not sure how it works in other databases, or if it's even implemented
>at all. for this reason, would it be more appropriate to create new
>modules that inherit from the 2 mentioned above and supply new
>limit/offset method(s)? for example:
>
>Class::DBI::AbstractSearch::Pg
>SQL::Abstract::Pg
>
>
>
>
>
>
|
|
Re: adding LIMIT, OFFSET to CDBI::AbstractSearch and SQL::Abstract
Alexander Karelas 15:20 on 27 Apr 2004
|