[Dbix-class] faking ResultSets

Richard Jolly Richard.Jolly at bbc.co.uk
Wed Jan 25 18:18:42 CET 2006


> From: dbix-class-bounces at lists.rawmode.org 
> [mailto:dbix-class-bounces at lists.rawmode.org] On Behalf Of 
> Matt S Trout
> Sent: 25 January 2006 17:05
> To: dbix-class at lists.rawmode.org
> Subject: Re: [Dbix-class] faking ResultSets
> 
> On Wed, Jan 25, 2006 at 03:00:58PM -0000, Richard Jolly wrote:
> > Hi,
> > 
> > We have a growing mismatch in our code between methods that return 
> > ResultSet objects and those that return an array/arrayref 
> > of objects.
> > This is in a Catalyst model layer.

[snip]
 
> > Is there a common solution to this problem? How do people 
> > keep their api consistent?
> 
> You could provide a fake object that just returns things as 
> ->next is called on it fairly trivially, but I'm not sure 
> that's the ideal solution.
> 
> What sort of objects are ending up in @records? I wonder if 
> you mightn't be able to return a proper resultset for the 
> query as of 0.05 unless it's a really insane one :)

I hope so, but we've not yet played with the new stuff. We do have a
particurlarly nasty schema. I'll see if I can put together an example.

But even in some trivial cases - for lists outside of the model classes
for example - it might be nice to unify the interface. Otherwise people
using template toolkit have to know what kind of list they've got in
order to be able to treat it sensibly.

Thanks for the fantastic work, BTW.

Richard

> -- 
>      Matt S Trout       Offering custom development, 

http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.



More information about the Dbix-class mailing list