Skip Menu |

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

Report information
The Basics
Id: 4911
Status: resolved
Priority: 0/
Queue: Class-DBI

People
Owner: Nobody in particular
Requestors: ianh [...] cnet.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in:
  • 0.94
  • 0.95
Fixed in: (no value)



Subject: Class::DBI .. search_like ignores order_by
if I do something like $iterator = $t->search_like ( {"name" => $filtername, "description" => $filterdesc }, { order_by=>"requested_deployment desc"} ); it ignores the order_by clause. in sub _do_search you do something like @args = %{ $args[0] } if ref $args[0] eq "HASH"; which I think looses $args[1] if it is there. my ugly fix was to do: my $search_opts; if (@args >1 && ref $args[1] eq "HASH") { $search_opts = $args[1]; } else { $search_opts = @args % 2 ? pop @args : {}; } just above that line which sets the search_opts before you play with the @args. it seems to work for me. (aploagies if this is fixed in 0.95, I looked at the changelog and couldn't see it)
Date: Sun, 11 Jan 2004 23:37:44 +0000
From: Tony Bowden <tony [...] kasei.com>
To: Guest via RT <bug-Class-DBI [...] rt.cpan.org>
Subject: Re: [cpan #4911] Class::DBI .. search_like ignores order_by
RT-Send-Cc:
On Sun, Jan 11, 2004 at 06:05:58PM -0500, Guest via RT wrote: Show quoted text
> if I do something like > $iterator = $t->search_like( > {"name" => $filtername, "description" => $filterdesc }, > { order_by=>"requested_deployment desc"} ); > it ignores the order_by clause.
Passing the arguments to search as a hashref rather than a list isn't really a documented usage. The fact that it happens to work is a legacy issue, and, partially, a convenience. That fact that it also happens to ignore any second hashref is mostly a consequence of this, and I'm reluctant to class it as a bug. I'm also reluctant to "fix" it, as the workaround is quite simple: $iterator = $t->search_like( "name" => $filtername, "description" => $filterdesc, { order_by=>"requested_deployment desc"} ); Of course, I'm always open to persuasion... Tony
From: ianh [...] cnet.com
[tony@kasei.com - Sun Jan 11 18:37:51 2004]: Show quoted text
> On Sun, Jan 11, 2004 at 06:05:58PM -0500, Guest via RT wrote: > > Passing the arguments to search as a hashref rather than a list isn't > really a documented usage.
sorry about that. I misread the documentation. please close this. Show quoted text
> > Of course, I'm always open to persuasion...
spend your time doing real work ;-) Cheers Ian Show quoted text
> > Tony >