Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread Derek Watson
I agree that performing a group of actions in a single transaction is one of the prettiest features of RDBO, and I also like John's approach to making these shortcuts to Manager routines. I find myself constantly re-writing my table relationships for manager calls. On 2/6/07, Ask Bjørn Hansen <

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread Ask Bjørn Hansen
On Feb 6, 2007, at 11:22 AM, John Siracusa wrote: > I'm not a big fan of the *_now method types, however, which is why > they're not the defaults. OTOH, a delete_on_save method might seem > strange when doing something like this: I don't think so. I was working on converting a small CDBI app (

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread Jud
John Siracusa wrote: > How about a delete_now method type for 1-to-m relationships (same arg > formats as the "find" method type): +1 for this. Would be very helpful. - Using Tomcat but need to do more? Need to support web s

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread John Siracusa
On 2/6/07, Derek Watson <[EMAIL PROTECTED]> wrote: > That was pretty much my position, too -- I was looking for something more > semantically appropriate. My task was trivial to solve in one or two ways, I > just didn't see any examples on how to do this stuff elegantly. What I am > really looking

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread Clayton Scott
On 2/6/07, Ted Zlatanov <[EMAIL PROTECTED]> wrote: On Tue, 6 Feb 2007 13:19:37 -0500 "John Siracusa" <[EMAIL PROTECTED]> wrote: JS> my($price) = grep { $_->region eq 'UK' } $p->prices; JS> $price->delete; JS> $p->prices(undef);# forget previously fetched collection JS> @pric

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread Derek Watson
That was pretty much my position, too -- I was looking for something more semantically appropriate. My task was trivial to solve in one or two ways, I just didn't see any examples on how to do this stuff elegantly. What I am really looking for is something expressive like $product->find_prices(qu

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread Ted Zlatanov
On Tue, 6 Feb 2007 13:19:37 -0500 "John Siracusa" <[EMAIL PROTECTED]> wrote: JS> After doing that, you could set prices to undef to cause the JS> collection to be re-fetched from the database on the next access: JS> my($price) = grep { $_->region eq 'UK' } $p->prices; JS> $price->delete;

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread John Siracusa
On 2/6/07, Derek Watson <[EMAIL PROTECTED]> wrote: > How would I go about deleting only the UK price? The following seems to > delete the UK price record, but leaves it in the collection of $p->prices. > > my ($price) = grep { $_->region eq 'UK' } $p->prices; > $price->delete; After doing that, yo

[RDBO] Deleting from a one-to-many

2007-02-06 Thread Derek Watson
Hello, What is the recommended idiom for deleting a single object from a one-to-many relationship? Using the textbook example, $p = Product->new(name => 'Kite'); $p->prices({ price => 1.23, region => 'US' }, { price => 4.56, region => 'UK' }); $p->save; # database is modified here Ho