Skip Menu |

This queue is for tickets about the Class-DBI-Plugin-Pager CPAN distribution.

Report information
The Basics
Id: 20842
Status: new
Priority: 0/
Queue: Class-DBI-Plugin-Pager

People
Owner: Nobody in particular
Requestors: bobtfish [...] bobtfish.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.561
Fixed in: (no value)



Subject: SQL::Abstract still eats where clauses..
In the source code to Class::DBI::Plugin::Pager there is a 'where' method which is commented out. This states that SQL::Abstract eats where clauses and so they need to be deep copied and has code to do the same. I don't know why it's commented out as this is still the case. I have a where clause that looks like: my $where = { status_id => [ 1, 2, 3, 4 ], -nest => [ col1 => { '=' => 'foo' }, col2 => { 'LIKE' => 'bar' } ] }; All the data inside the '-nest' key is eaten in the first call to SQL::Abstract used to get the COUNT(*) from the table, so it fails the 2nd time round.. I have implemented the following code in my top level model class which fixes the issue (and proves it's a problem with the 'where' method / SQL::Abstract interaction): { #Class::DBI::Plugin::Pager has a where method that deep copies the where clause, but this is commented out. # this causes bugs when you have a complex where clause as SQL::Abstract eats it. This is A BIG FAT HACK! my $old_where = \&Class::DBI::Plugin::Pager::where; use Clone qw/clone/; my $new_where = sub { return(clone(&{$old_where}(@_))); }; { no warnings; *Class::DBI::Plugin::Pager::where = $new_where; }; };