Update POD, because of new connect_by implemenation
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / InterBase.pm
index 6fd783f..a416fa7 100644 (file)
@@ -18,9 +18,9 @@ DBIx::Class::Storage::DBI::InterBase - Driver for the Firebird RDBMS
 
 =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
@@ -40,9 +40,10 @@ sub _prep_for_execute {
   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]{$_};
@@ -59,7 +60,6 @@ sub _prep_for_execute {
     if (@auto_inc_cols) {
       $args->[1]{returning} = \@auto_inc_cols;
 
-      $self->_auto_incs([]);
       $self->_auto_incs->[0] = \@auto_inc_cols;
     }
   }
@@ -155,6 +155,21 @@ sub last_insert_id {
   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 {