[Dbix-class] can't get last insert id on create() with mysql
Robert Stockdale
robert.stockdale at gmail.com
Sun Nov 22 00:46:21 GMT 2009
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} =3D \'(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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091121/cf4=
07844/attachment.htm
More information about the DBIx-Class
mailing list