Re: [RDBO] Elegant way to generically query a table?

2006-10-20 Thread James Masters
Hi John et al, This is all working wonderfully. But now I want to do a similar thing with an individual record for which I know the primary key value. I assume it's quickest/best to use Rose::DB::Object rather than Manager in this case. But I can't see in the documentation how to specify the

Re: [RDBO] Elegant way to generically query a table?

2006-10-20 Thread John Siracusa
On 10/20/06 2:37 AM, James Masters wrote: This is all working wonderfully. But now I want to do a similar thing with an individual record for which I know the primary key value. I assume it's quickest/best to use Rose::DB::Object rather than Manager in this case. But I can't see in the

Re: [RDBO] Elegant way to generically query a table?

2006-10-20 Thread James Masters
Thanks again. I'm used to much less concise code - it's almost too easy! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Siracusa Sent: 20 October 2006 13:40 To: Rose-DB-Object Subject: Re: [RDBO] Elegant way to generically query a table

Re: [RDBO] Elegant way to generically query a table?

2006-10-20 Thread Ask Bjørn Hansen
On Oct 20, 2006, at 5:39 AM, John Siracusa wrote: [...] If you know the class name already, just do this: $record = $class-new(primarykeyfieldname = $pk)-load; We (well, Graham) made the following manager class that gives us fetch and fetch_or_create methods to shorten the

Re: [RDBO] Elegant way to generically query a table?

2006-10-20 Thread John Siracusa
On 10/20/06 3:05 PM, Ask Bjørn Hansen wrote: We (well, Graham) made the following manager class that gives us fetch and fetch_or_create methods to shorten the -new(...)-load stuff and to factor out the speculative option logic. On the object side of things (as opposed to the Manager) keep min

Re: [RDBO] Elegant way to generically query a table?

2006-10-15 Thread Jonathan Vanasco
On Oct 14, 2006, at 9:58 PM, John Siracusa wrote: I think they key piece of knowledge you're missing is that a call like: $objs = My::Whatever::Manager-get_whatevers(...); is exactly equivalent to: $objs = Rose::DB::Object::Manager-get_objects( object_class =

Re: [RDBO] Elegant way to generically query a table?

2006-10-15 Thread John Siracusa
On 10/15/06 3:07 PM, Jonathan Vanasco wrote: On Oct 14, 2006, at 9:58 PM, John Siracusa wrote: I think they key piece of knowledge you're missing is that a call like: $objs = My::Whatever::Manager-get_whatevers(...); is exactly equivalent to: $objs =

[RDBO] Elegant way to generically query a table?

2006-10-14 Thread James Masters
I'm trying to write generic code that will work for any table. The following does work but it's ugly. (I'm still just prototyping so please excuse the nofrills output format). I suspect I'm labouring under all sorts of naive misunderstandings. Does anyone know ways to improve this? In