$self->store_column($auto_pri[$_] => $ids[$_]) for 0 .. $#ids;
}
+ # get non-PK auto-incs
+ {
+ my $rsrc = $self->result_source;
+ my %pk;
+ @pk{ $rsrc->primary_columns } = ();
+
+ my @non_pk_autoincs = grep {
+ (not exists $pk{$_})
+ && (not defined $self->get_column($_))
+ && $rsrc->column_info($_)->{is_auto_increment}
+ } $rsrc->columns;
+
+ if (@non_pk_autoincs) {
+ my @ids = $rsrc->storage->last_insert_id($rsrc, @non_pk_autoincs);
+
+ if (@ids == @non_pk_autoincs) {
+ $self->store_column($non_pk_autoincs[$_] => $ids[$_]) for 0 .. $#ids;
+ }
+ }
+ }
$self->{_dirty_columns} = {};
$self->{related_resultsets} = {};
to C<update>, e.g. ( { %{ $href } } )
If the values passed or any of the column values set on the object
-contain scalar references, eg:
+contain scalar references, e.g.:
$row->last_modified(\'NOW()');
# OR
the new object.
Relationships will be followed by the copy procedure B<only> if the
-relationship specifes a true value for its
+relationship specifies a true value for its
L<cascade_copy|DBIx::Class::Relationship::Base> attribute. C<cascade_copy>
is set by default on C<has_many> relationships and unset on all others.
$new->insert;
# Its possible we'll have 2 relations to the same Source. We need to make
- # sure we don't try to insert the same row twice esle we'll violate unique
+ # sure we don't try to insert the same row twice else we'll violate unique
# constraints
my $rels_copied = {};