=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') {
- my @pk = $ident->_pri_cols;
+ $self->_auto_incs([]);
+
my %pk;
- @pk{@pk} = ();
+ @pk{$ident->primary_columns} = ();
my @auto_inc_cols = grep {
my $inserting = $args->[0]{$_};
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 {