[Dbix-class] Can't get last insert id ?!
Matt S Trout
dbix-class at trout.me.uk
Fri Nov 10 08:47:08 GMT 2006
Ivan.Georgiev at uboc.com wrote:
> here is the code :
> $schema->resultset('tableX')->create(\%record);
>
>
> here is dump of the %record :
> $VAR1 = {
> 'field6' => '1',
> 'field5' => 'PP ',
> 'field1' => '00000000000011716438',
> 'field2' => 0,
> 'field3' => '0000001',
> 'field4' => '102737 '
> };
>
> and here is what i see when run the script like this :
> # DBIC_TRACE=1 ./loader.pl
>
>
> INSERT INTO tableX (field1, field2, field3, field4, field5, field6) VALUES
> (?, ?, ?, ?, ?, ?): '00000000000011716438', '0', '0000001', '102737
> ', 'PP ', '1'
> DBIx::Class::ResultSet::create(): Can't get last insert id at
> /path/to/Loader.pm line 114
You didn't pass a PK and mysql's not letting you get the inserted id back - is
the PK marked AUTO_INCREMENT?
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list