[Bast-commits] r8507 - DBIx-Class/0.08/branches/sybase_asa/t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Tue Feb 2 13:48:12 GMT 2010
Author: caelum
Date: 2010-02-02 13:48:11 +0000 (Tue, 02 Feb 2010)
New Revision: 8507
Modified:
DBIx-Class/0.08/branches/sybase_asa/t/749sybase_asa.t
Log:
test blobs, they work, didn't have to do anything
Modified: DBIx-Class/0.08/branches/sybase_asa/t/749sybase_asa.t
===================================================================
--- DBIx-Class/0.08/branches/sybase_asa/t/749sybase_asa.t 2010-02-02 13:33:57 UTC (rev 8506)
+++ DBIx-Class/0.08/branches/sybase_asa/t/749sybase_asa.t 2010-02-02 13:48:11 UTC (rev 8507)
@@ -6,12 +6,12 @@
use lib qw(t/lib);
use DBICTest;
+# tests stolen from 748informix.t
+
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_SYBASE_ASA_${_}" } qw/DSN USER PASS/};
-#warn "$dsn $user $pass";
-
plan skip_all => 'Set $ENV{DBICTEST_SYBASE_ASA_DSN}, _USER and _PASS to run this test'
- unless ($dsn && $user);
+ unless ($dsn);
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -72,11 +72,44 @@
is( $lim->next->artistid, 102, "iterator->next ok" );
is( $lim->next, undef, "next past end of resultset ok" );
+# test blobs (stolen from 73oracle.t)
+eval { $dbh->do('DROP TABLE bindtype_test') };
+$dbh->do(qq[
+CREATE TABLE bindtype_test
+(
+ id INT NOT NULL PRIMARY KEY,
+ bytea INT NULL,
+ blob LONG BINARY NULL,
+ clob LONG VARCHAR NULL
+)
+],{ RaiseError => 1, PrintError => 1 });
+my %binstr = ( 'small' => join('', map { chr($_) } ( 1 .. 127 )) );
+$binstr{'large'} = $binstr{'small'} x 1024;
+
+my $maxloblen = length $binstr{'large'};
+local $dbh->{'LongReadLen'} = $maxloblen;
+
+my $rs = $schema->resultset('BindType');
+my $id = 0;
+
+foreach my $type (qw( blob clob )) {
+ foreach my $size (qw( small large )) {
+ $id++;
+
+ lives_ok { $rs->create( { 'id' => $id, $type => $binstr{$size} } ) }
+ "inserted $size $type without dying";
+
+ ok($rs->find($id)->$type eq $binstr{$size}, "verified inserted $size $type" );
+ }
+}
+
done_testing;
# clean up our mess
END {
my $dbh = eval { $schema->storage->_dbh };
- $dbh->do("DROP TABLE artist") if $dbh;
+ if ($dbh) {
+ $dbh->do("DROP TABLE $_") for qw/artist bindtype_test/;
+ }
}
More information about the Bast-commits
mailing list