X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FPg.pm;h=41b2357aaf6812196321bce1c4826666f050f310;hb=5fd73721c5877a68d3ca0746e27f52701b57790d;hp=fdf308edc0102d15dfe61e1deb88be8be556f0a2;hpb=adb3554a3f72bf9c9b267c5eb84a8401da64bf37;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index fdf308e..41b2357 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -5,7 +5,7 @@ use warnings; use DBD::Pg qw(:pg_types); -use base qw/DBIx::Class::Storage::DBI/; +use base qw/DBIx::Class::Storage::DBI::MultiColumnIn/; # __PACKAGE__->load_components(qw/PK::Auto/); @@ -13,6 +13,13 @@ use base qw/DBIx::Class::Storage::DBI/; warn "DBD::Pg 1.49 is strongly recommended" if ($DBD::Pg::VERSION < 1.49); +sub with_deferred_fk_checks { + my ($self, $sub) = @_; + + $self->dbh->do('SET CONSTRAINTS ALL DEFERRED'); + $sub->(); +} + sub _dbh_last_insert_id { my ($self, $dbh, $seq) = @_; $dbh->last_insert_id(undef, undef, undef, undef, {sequence => $seq}); @@ -63,6 +70,7 @@ sub bind_attribute_by_data_type { my $bind_attributes = { bytea => { pg_type => DBD::Pg::PG_BYTEA }, + blob => { pg_type => DBD::Pg::PG_BYTEA }, }; if( defined $bind_attributes->{$data_type} ) { @@ -80,21 +88,21 @@ sub _sequence_fetch { } sub _svp_begin { - my ($self, $dbh, $name) = @_; + my ($self, $name) = @_; - $dbh->pg_savepoint($name); + $self->dbh->pg_savepoint($name); } sub _svp_release { - my ($self, $dbh, $name) = @_; + my ($self, $name) = @_; - $dbh->pg_release($name;) + $self->dbh->pg_release($name); } sub _svp_rollback { - my ($self, $dbh, $name) = @_; + my ($self, $name) = @_; - $dbh->pg_rollback_to($name); + $self->dbh->pg_rollback_to($name); } 1;