[Catalyst] create_related is failing on second time through loop?

Robert Wohlfarth rbwohlfarth at gmail.com
Tue Jun 19 18:22:11 GMT 2012


On Tue, Jun 19, 2012 at 11:20 AM, Tim Anderson <tja824 at gmail.com> wrote:

> Greetings,
>      foreach my $new_role (@{$roles}) {
>        $c->log->debug("Creating new role: " . Dumper($new_role));
>
>        $existing_record->create_related ('portal_user_roles', { role_id =
=3D>
> $new_role });  #first time through works, but fails on second pass
>

[snip]


> When I set DBIC_TRACE=3D1, I see the following stack trace:
>
>
> DBIx::Class::Schema::throw_exception('Portal::Schema=3DHASH(0x35fd380)',
> 'Unknown error: execute() returned false, but error flags were...') called
> at /usr/local/share/perl5/DBIx/Class/Storage.pm line 111
>
> DBIx::Class::Storage::throw_exception('DBIx::Class::Storage::DBI::Sybase:=
:Microsoft_SQL_Server::Free...',
> 'Unknown error: execute() returned false, but error flags were...') called
> at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 1594
>
> DBIx::Class::Storage::DBI::_dbh_execute('DBIx::Class::Storage::DBI::Sybas=
e::Microsoft_SQL_Server::Free...',
> 'DBI::db=3DHASH(0x51679a0)', 'INSERT INTO PORTAL_USER_ROLE ( client_id,
> role_id, user_id) V...', 'ARRAY(0x4fa0490)', 'ARRAY(0x533ea30)') called at
> /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 789
>

I see that you send $new_role to the log. What is the value when it
crashes? An invalid value may cause unhelpful errors.

-- =

Robert Wohlfarth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120619/74719=
790/attachment.htm


More information about the Catalyst mailing list