Re: search() without search criteria

[prev] [thread] [next] [Date index for 2005/04/29]

From: Perrin Harkins
Subject: Re: search() without search criteria
Date: 14:25 on 29 Apr 2005
Will Hawes wrote:
> This works fine when search criteria are specified:
> 
> $class->search(column1 => value, {rows => 10});

Really?  What are you using?  Class::DBI doesn't support that, as far as 
I can see.  Are you using one of the subclasses that has LIMIT support 
added?

> I'm aware there are probably workarounds - using retrieve_all() to return an iterator is one that springs to mind, a custom constructor is another - but I want to avoid returning whole result sets into memory or, worse, writing custom SQL.


Well, search() does load the whole result set into memory...

> I'd like to hear opinions regarding a patch to Class::DBI so that search() accepts an empty hash as the first argument.

A better approach would be to just make search() call retrieve_all() 
when it gets no arguments for columns.  Making retrieve use LIMIT (or 
equivalent) is no harder than making search() do it.  I hacked it into 
the base class we use here a while back.

- Perrin


(message missing)

search() without search criteria
Will Hawes 12:36 on 29 Apr 2005

Re: search() without search criteria
Matt S Trout 13:18 on 29 Apr 2005

Re: search() without search criteria
Daniel Wijnands 14:06 on 29 Apr 2005

Re: search() without search criteria
Perrin Harkins 14:25 on 29 Apr 2005

Re: search() without search criteria
Will Hawes 16:53 on 29 Apr 2005

Re: search() without search criteria
Tony Bowden 18:38 on 29 Apr 2005

Re: search() without search criteria
Matt S Trout 19:38 on 29 Apr 2005

Re: search() without search criteria
Will Hawes 20:19 on 29 Apr 2005

Re: search() without search criteria
Tony Bowden 22:48 on 29 Apr 2005

Re: search() without search criteria
Perrin Harkins 16:40 on 30 Apr 2005

Re: search() without search criteria
David Baird 14:31 on 29 Apr 2005

Re: search() without search criteria
Peter Speltz 19:11 on 29 Apr 2005

Re: search() without search criteria
Tony Bowden 22:52 on 29 Apr 2005

Re: search() without search criteria
Will Hawes 12:13 on 30 Apr 2005

Re: search() without search criteria
Tony Bowden 12:19 on 30 Apr 2005

Re: search() without search criteria
merlyn (Randal L. Schwartz) 15:44 on 30 Apr 2005

Re: search() without search criteria
Will Hawes 17:45 on 30 Apr 2005

Re: search() without search criteria
Tony Bowden 10:27 on 01 May 2005

Re: search() without search criteria
Will Hawes 14:13 on 01 May 2005

Generated at 10:24 on 04 May 2005 by mariachi v0.52