X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=806cef8aadce3cfde9908c7313ce6be6fdef8084;hb=2eebd801e7300ecc24a68c0062f35aa72775908f;hp=cf618467a429b8d5b7e4b0858161f121e5dec60d;hpb=c59a8859b3f13aa8a7e2ee0d43767807b9522296;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index cf61846..806cef8 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -709,6 +709,28 @@ sub disconnect { } } +=head2 with_deferred_fk_checks + +=over 4 + +=item Arguments: C<$coderef> + +=item Return Value: The return value of $coderef + +=back + +Storage specific method to run the code ref with FK checks deferred or +in MySQL's case disabled entirely. + +=cut + +# Storage subclasses should override this +sub with_deferred_fk_checks { + my ($self, $sub) = @_; + + $sub->(); +} + sub connected { my ($self) = @_; @@ -1129,12 +1151,12 @@ sub insert { my $ident = $source->from; my $bind_attributes = $self->source_bind_attributes($source); + $self->ensure_connected; foreach my $col ( $source->columns ) { if ( !defined $to_insert->{$col} ) { my $col_info = $source->column_info($col); if ( $col_info->{auto_nextval} ) { - $self->ensure_connected; $to_insert->{$col} = $self->_sequence_fetch( 'nextval', $col_info->{sequence} || $self->_dbh_get_autoinc_seq($self->dbh, $source) ); } }