Re: Beginner many-to-many problems
[prev]
[thread]
[next]
[Date index for 2004/07/12]
On Sun, Jul 11, 2004 at 01:40:38PM -0400, Edward J. Sabol wrote:
> Jesse Sheidlower wrote:
> >> Second, I'd like to add a citation with accompanying subjects,
> >> preferably in one shot.
>
> Tony replied:
> > You can't. You'll need to write something yourself to do this.
>
> Jesse, assuming you're using a database that supports transactions, check out
> http://www.class-dbi.com/cgi-bin/wiki/index.cgi?AtomicUpdates
Thanks, but I'm afraid I am not using a transaction-capable database
(I'm using MySQL with MyISAM tables).
Is it the multiple addition that I would have to write myself? What
would be the way of adding a single subject to an existing citation
object? Again, the basic setup is that there's a many-to-many
correspondence between my Citation class and my Subject class, looking
like this:
package Citations;
use base 'Citations::DBI';
__PACKAGE__->set_up_table("citation");
__PACKAGE__->has_many(subject => [ CitationSubject => 'subject_id' ]);
Thanks very much.
Jesse Sheidlower