support ::DBI::Replicated opts in connect_info
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Pg.pm
index a2d7f1e..5fcaa17 100644 (file)
@@ -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} ) {
@@ -79,6 +87,24 @@ sub _sequence_fetch {
   return $id;
 }
 
+sub _svp_begin {
+    my ($self, $name) = @_;
+
+    $self->dbh->pg_savepoint($name);
+}
+
+sub _svp_release {
+    my ($self, $name) = @_;
+
+    $self->dbh->pg_release($name);
+}
+
+sub _svp_rollback {
+    my ($self, $name) = @_;
+
+    $self->dbh->pg_rollback_to($name);
+}
+
 1;
 
 =head1 NAME