$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} = {};
=head1 DESCRIPTION
-This class implements autoincrements for Firebird using C<RETURNING>, sets the
-limit dialect to C<FIRST X SKIP X> and provides
-L<DBIx::Class::InflateColumn::DateTime> support.
+This class implements autoincrements for Firebird using C<RETURNING> as well as
+L<auto_nextval|DBIx::Class::ResultSource/auto_nextval> sets the limit dialect to
+C<FIRST X SKIP X> and provides L<DBIx::Class::InflateColumn::DateTime> support.
You need to use either the
L<disable_sth_caching|DBIx::Class::Storage::DBI/disable_sth_caching> option or
my ($op, $extra_bind, $ident, $args) = @_;
if ($op eq 'insert') {
+ $self->_auto_incs([]);
+
my @pk = $ident->_pri_cols;
my %pk;
@pk{@pk} = ();
if (@auto_inc_cols) {
$args->[1]{returning} = \@auto_inc_cols;
- $self->_auto_incs([]);
$self->_auto_incs->[0] = \@auto_inc_cols;
}
}
return @result;
}
+sub insert {
+ my $self = shift;
+
+ my $updated_cols = $self->next::method(@_);
+
+ if ($self->_auto_incs->[0]) {
+ my %auto_incs;
+ @auto_incs{ @{ $self->_auto_incs->[0] } } = @{ $self->_auto_incs->[1] };
+
+ $updated_cols = { %$updated_cols, %auto_incs };
+ }
+
+ return $updated_cols;
+}
+
# this sub stolen from DB2
sub _sql_maker_opts {