use strict;
-use warnings;
+use warnings;
use Test::More;
use lib qw(t/lib);
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 });
],{ 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
$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
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)
$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") };
+