Class::DBI::Plugin::Pager & Class::DBI::Plugin::CountSearch

[prev] [thread] [next] [Date index for 2005/03/30]

From: Dave Howorth
Subject: Class::DBI::Plugin::Pager & Class::DBI::Plugin::CountSearch
Date: 13:38 on 30 Mar 2005
This is a multi-part message in MIME format.
--------------020904070208080908050803
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I've just patched Class::DBI::Plugin::Pager so it can use 
Class::DBI::Plugin::CountSearch instead of 
Class::DBI::Plugin::AbstractCount.

I have large tables, so I wanted to use Plugin-Pager in my Maypole app. 
But I make use of CDBI's accessor_name functionality and AbstractCount 
doesn't handle that. OTOH, CountSearch does. So I've written a patch so 
Plugin-Pager will use either. I also implemented 
retrieve_all_sorted_by() for Maypole to call.

The patch appears to work for me but has had next to no testing. I know 
there are some cases it doesn't handle but I don't know whether they 
occur in Maypole apps. I'm also not confident I understand either 
Plugin-Pager or the CDBI/database stuff well enough to write bug free 
code. But I thought it was best to post it so anybody who knows more can 
improve it :)

Cheers, Dave

--------------020904070208080908050803
Content-Type: text/plain;
 name="pager.diff"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="pager.diff"

LS0tIC91c3IvbG9jYWwvc2hhcmUvcGVybC81LjYuMS9DbGFzcy9EQkkvUGx1Z2luL1BhZ2Vy
LnBtCVNhdCBKYW4gMTUgMDE6MTA6MTggMjAwNQorKysgQ2xhc3MvREJJL1BsdWdpbi9NeVBh
Z2VyLnBtCVdlZCBNYXIgMzAgMTQ6MTk6MTggMjAwNQpAQCAtMSw0ICsxLDQgQEAKLXBhY2th
Z2UgQ2xhc3M6OkRCSTo6UGx1Z2luOjpQYWdlcjsNCitwYWNrYWdlIENsYXNzOjpEQkk6OlBs
dWdpbjo6TXlQYWdlcjsNCiB1c2Ugc3RyaWN0Ow0KIHVzZSB3YXJuaW5nczsNCiB1c2UgQ2Fy
cDsNCkBAIC0zNCw2ICszNCw3IEBACiAgICAgdXNlIGJhc2UgJ0NsYXNzOjpEQ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YWxseSkgYW5kIHNvcnQNCiB0aGUgZW50
aXJlIHJlc3VsdHMgc2V0LCBiZWZvcmUgY2hvcHBpbmcgb3V0IHRoZSByZXF1ZXN0ZWQgc3Vi
c2V0LiBJdCdzIHByb2JhYmx5DQogYSBnb29kIGlkZWEgdG8gaGF2ZSBhbiBpbmRleCBvbiB0
aGUgY29sdW1uKHMpIHVzZWQgdG8gb3JkZXIgdGhlIHJlc3VsdHMuIEZvcg0KQEAgLTU4OCw2
ICs2MzEsNyBAQAogTDxTUUw6OkFic3RyYWN0fFNRTDo6QWJzdHJhY3Q+LA0KIEw8RGF0YTo6
UGFnZXxEYXRhOjpQYWdlPiwNCiBMPENsYXNzOjpEQkk6OlBsdWdpbjo6QWJzdHJhY3RDb3Vu
dHxDbGFzczo6REJJOjpQbHVnaW46OkFic3RyYWN0Q291bnQ+LA0KK0w8Q2xhc3M6OkRCSTo6
UGx1Z2luOjpDb3VudFNlYXJjaHxDbGFzczo6REJJOjpQbHVnaW46OkNvdW50U2VhcmNoPiwN
CiBMPENsYXNzOjpBY2Nlc3NvcnxDbGFzczo6QWNjZXNzb3I+LA0KIEw8Q2xhc3M6OkRhdGE6
OkluaGVyaXRhYmxlfENsYXNzOjpEYXRhOjpJbmhlcml0YWJsZT4sDQogTDxDYXJwfENhcnA+
Lg0K
--------------020904070208080908050803--

Class::DBI::Plugin::Pager & Class::DBI::Plugin::CountSearch
Dave Howorth 13:38 on 30 Mar 2005

Generated at 14:42 on 11 Apr 2005 by mariachi v0.52