Temporary fixes for 5.13.x $@ handling
[dbsrgits/DBIx-Class.git] / t / bind / bindtype_columns.t
index 1462d9b..a6be997 100644 (file)
@@ -1,5 +1,5 @@
 use strict;
-use warnings;  
+use warnings;
 
 use Test::More;
 use lib qw(t/lib);
@@ -9,8 +9,6 @@ my ($dsn, $dbuser, $dbpass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/}
 
 plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
   unless ($dsn && $dbuser);
-  
-plan tests => 6;
 
 my $schema = DBICTest::Schema->connection($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
 
@@ -32,7 +30,9 @@ my $dbh = $schema->storage->dbh;
     ],{ RaiseError => 1, PrintError => 1 });
 }
 
-my $big_long_string    = "\x00\x01\x02 abcd" x 125000;
+$schema->storage->debug(0); # these tests spew up way too much stuff, disable trace
+
+my $big_long_string = "\x00\x01\x02 abcd" x 125000;
 
 my $new;
 # test inserting a row
@@ -40,7 +40,7 @@ my $new;
   $new = $schema->resultset('BindType')->create({ bytea => $big_long_string });
 
   ok($new->id, "Created a bytea row");
-  is($new->bytea,      $big_long_string, "Set the blob correctly.");
+  is($new->bytea, $big_long_string, "Set the blob correctly.");
 }
 
 # test retrieval of the bytea column
@@ -49,10 +49,7 @@ my $new;
   is($row->get_column('bytea'), $big_long_string, "Created the blob correctly.");
 }
 
-TODO: {
-  local $TODO =
-    'Passing bind attributes to $sth->bind_param() should be implemented (it only works in $storage->insert ATM)';
-
+{
   my $rs = $schema->resultset('BindType')->search({ bytea => $big_long_string });
 
   # search on the bytea column (select)
@@ -83,6 +80,15 @@ TODO: {
       $schema->txn_rollback;
     });
   }
+
+  # create with blob from $rs
+  $new = $rs->create({});
+  is($new->bytea, $big_long_string, 'Object has bytea value from $rs');
+  $new->discard_changes;
+  is($new->bytea, $big_long_string, 'bytea value made it to db');
 }
 
-$dbh->do("DROP TABLE bindtype_test");
+done_testing;
+
+eval { $dbh->do("DROP TABLE bindtype_test") };
+