fixed test resultclass formatting, added a few more DBIC::Storage::DBI methods that...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Pg.pm
index bd28e02..3fcd550 100644 (file)
@@ -3,15 +3,21 @@ package DBIx::Class::Storage::DBI::Pg;
 use strict;
 use warnings;
 
+use base qw/DBIx::Class::Storage::DBI::MultiColumnIn/;
+use mro 'c3';
+
 use DBD::Pg qw(:pg_types);
 
-use base qw/DBIx::Class::Storage::DBI/;
+# Ask for a DBD::Pg with array support
+warn "DBD::Pg 2.9.2 or greater is strongly recommended\n"
+  if ($DBD::Pg::VERSION < 2.009002);  # pg uses (used?) version::qv()
 
-# __PACKAGE__->load_components(qw/PK::Auto/);
+sub with_deferred_fk_checks {
+  my ($self, $sub) = @_;
 
-# Warn about problematic versions of DBD::Pg
-warn "DBD::Pg 1.49 is strongly recommended"
-  if ($DBD::Pg::VERSION < 1.49);
+  $self->dbh->do('SET CONSTRAINTS ALL DEFERRED');
+  $sub->();
+}
 
 sub _dbh_last_insert_id {
   my ($self, $dbh, $seq) = @_;
@@ -63,6 +69,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} ) {