I have a table that looks like this:
CREATE TABLE whatever (
id SERIAL PRIMARY KEY,
whatever_id INTEGER NOT NULL REFERENCES whatever(id),
.
.
.
);
Now when I populate the table for the very first time, the first row
will reference itself. Some other rows will ref themselves, some will
ref other rows.
My question : when I do
my $w = $schema->resultset('Whatever')->create( ... )
I need to basically say
{whatever_id => this.id,
.... }
but of course it isn't "this" ....
Is there a way to get the id of the object being created in the
statement doing the creation? I don't even know if the db (postgresql)
can do that ... ?
The alternative is to make whatever_id not required, and post-fill it,
but I prefer not as it should always have a value.
Anyone know?
thanks
Daniel
--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/