[Dbix-class] Can't get last insert id ?!

Ivan.Georgiev at uboc.com Ivan.Georgiev at uboc.com
Fri Nov 10 19:25:26 GMT 2006


yes...that was my error... forgot ..'cause I modified the table and forgot
to specify auto_increment....;)
thanx


PS.
One thing may be not so important... is it possible so that we have a alias
to ->resultset() it is too long, especialy when u chain
several calls it eats up all the space ;)) ....... i.e.    ->rs()
As we talk about aliases, what about ;) :
$schema->from($table)->select(\%where);




|---------+---------------------------->
|         |           Matt S Trout     |
|         |           <dbix-class at trout|
|         |           .me.uk>          |
|         |                            |
|         |           11/10/2006 12:47 |
|         |           AM               |
|         |           Please respond to|
|         |           dbix-class       |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                    |
  |       To:       dbix-class at lists.rawmode.org                                                                       |
  |       cc:                                                                                                          |
  |       Subject:  Re: [Dbix-class] Can't get last insert id ?!                                                       |
  >--------------------------------------------------------------------------------------------------------------------|




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?

--




******************************************************************************
This communication (including any attachments) may contain privileged or
confidential information intended for a specific individual and purpose, 
and is protected by law.  If you are not the intended recipient, you should
delete this communication and/or shred the materials and any attachments and
are hereby notified that any disclosure, copying, or distribution of this
communication, or the taking of any action based on it, is strictly prohibited.

Thank you.




More information about the Dbix-class mailing list