Hello,

I have a mysql table with a two column primary key which I am attempting to
insert into using the create() method. One of the PK field values is being
set using a subquery, for example:

    # code to set other fields here...
    $fields->{id} = \'(SELECT FIELD1 FROM (SELECT MAX(FIELD1) + 1 FIELD1
FROM TABLE1) TEMP_T)';
    $c->model('DB::Table1')->create($fields);

The record is created as expected but the code blows up with "Can't get last
insert id" error.

Based on docs from DBIx::Class::Manual::Troubleshooting  I thought the issue
might be with DBI or DBD::mysql so I updated DBI to the latest version from
CPAN and I updated DBD::mysql to the latest version in the fedora repos
(having trouble w/ the CPAN install for this one so I can't get the absolute
newest version but its pretty close -- 4.005).

Is this an issue with DBIC, DBI, or DBD::mysql? I was hoping someone might
be able to point me in the right direction for diagnosing or working around
this issue. Or if it looks like I am going about this all wrong, please let
me know that as well. :-)

Any help is greatly appreciated!

Thanks,
-Bob
_______________________________________________
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