RE: rolling LIMIT into C::DBI::Mysql?
[prev]
[thread]
[next]
[Date index for 2004/07/28]
From: Rhesa Rozendaal Sent: 27 July 2004 20:18
>
>jason scott gessner wrote:
>
>> Hi All.
>>=20
>> I was about to do this, when I saw on the wiki that someone already
has=20
>> the code up for it:
>
>Heh, that was my hack.
>
>> $frag .=3D " LIMIT $search_opts->{limit}" if $search_opts->{limit};
>>=20
>> added to _do_search will give you limiting in the search options. If
i=20
>> were to prepare a patch to add this to C::DBI::MySQL, do you think
that=20
>> would be able to make it out and into a release?
>
>I wouldn't expect to see it in CDBI: it's too database specific. It=20
>won't work on SQL Server, for instance.
>I'd suggest we take it up with the developer of CDBI::Mysql or other=20
>db-specific modules that support LIMIT and/or OFFSET.
>
>Rhesa
How about including it in the main mod but have it call a method to make
the limit clause, then db specific sub-classes can override it to make
it
work (and include a default implementation that works for most db).
e.g.
$frag .=3D $self->mk_limit_frag($search_opts->{limit}) if
$search_opts->{limit};
sub mk_limit_frag { " LIMIT $_[0]"; }
mark
--
"In the beginning, there was nothing, which exploded."=20
This email (and any attachments) is intended solely for the individual(s) t=
o whom addressed. It may contain confidential and/or legally privileged inf=
ormation. Any statement or opinions therein are not necessarily those of IT=
N unless specifically stated. Any unauthorised use, disclosure or copying i=
s prohibited. If you have received this email in error, please notify the s=
ender and delete it from your system. Security and reliability of the e-mai=
l and attachments are not guaranteed. You must take full responsibility for=
virus checking.
Independent Television News Limited,=20
Registered No. 548648 England,
VAT Reg. No: GB 756 2995 81,=20
200 Gray's Inn Road, London WC1X 8XZ,
Telephone: 020 7833 3000.
|
|
RE: rolling LIMIT into C::DBI::Mysql?
Addison, Mark 12:11 on 28 Jul 2004
|