On Tue, Nov 18, 2008 at 12:00 PM, Zbigniew Lukasiak <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 18, 2008 at 6:16 PM, J. Shirley <[EMAIL PROTECTED]> wrote:
[snip]
> This is again the recursion in insert (see my email about backcompat
> and recursive insert).  I've tried this with my patch - but this time
> I've changed the create method to run the non-recursive version of
> insert and 5 of your tests passed.
>

I don't think that is right.

There were 6 tests, and only one failed.  The error is the one that
fails (test #3) :)

The problem is:
# Column name not loaded on DBICTest::DefaultJoin=HASH(0xa7d804)
trying to resolve relationship at lib/DBIx/Class/Schema.pm line 968

The core issue is quite simple.  This is because a single insert
doesn't fetch the column info from default values.

Assuming Foo has a column 'name' with a default_value.

my $obj = $schema->resultset('Foo')->create({ bar => 'baz' });
$obj->name; # undef

If something has default values, you have to do a discard_changes to
get all the data.  I thought it was only in relationships, but it
isn't.

-J

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to