X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F746db2_400.t;h=cb5213b83017015bf5163cb82e73178fea14dbb2;hb=refs%2Fheads%2Fpeople%2Filmari%2Fset-constraints-deffered-component;hp=9ebe7cc392073f37da3e9e74e442560b027e1b67;hpb=3ff5b74063e6bb299d8a7443df0e864254ea44b9;p=dbsrgits%2FDBIx-Class.git diff --git a/t/746db2_400.t b/t/746db2_400.t index 9ebe7cc..cb5213b 100644 --- a/t/746db2_400.t +++ b/t/746db2_400.t @@ -1,10 +1,14 @@ use strict; -use warnings; +use warnings; use Test::More; +use DBIx::Class::Optional::Dependencies (); use lib qw(t/lib); use DBICTest; +plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_db2_400') + unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_db2_400'); + my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_DB2_400_${_}" } qw/DSN USER PASS/}; #warn "$dsn $user $pass"; @@ -17,13 +21,20 @@ plan skip_all => 'Set $ENV{DBICTEST_DB2_400_DSN}, _USER and _PASS to run this te plan tests => 6; +require DBICTest::Schema; my $schema = DBICTest::Schema->connect($dsn, $user, $pass); my $dbh = $schema->storage->dbh; -$dbh->do("DROP TABLE artist", { RaiseError => 0, PrintError => 0 }); +eval { $dbh->do("DROP TABLE artist") }; -$dbh->do("CREATE TABLE artist (artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(255), charfield CHAR(10))"); +$dbh->do(<<''); +CREATE TABLE artist ( + artistid INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + name VARCHAR(255), + rank INTEGER default 13 not null, + charfield CHAR(10) +) # Just to test loading, already in Core $schema->class('Artist')->load_components('PK::Auto'); @@ -58,10 +69,15 @@ my $test_type_info = { 'is_nullable' => 1, 'size' => 255 }, + 'rank' => { + 'data_type' => 'INTEGER', + 'is_nullable' => 0, + 'size' => 10, + }, 'charfield' => { 'data_type' => 'CHAR', 'is_nullable' => 1, - 'size' => 10 + 'size' => 10 }, }; @@ -71,6 +87,7 @@ is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); # clean up our mess END { - $dbh->do("DROP TABLE artist") if $dbh; + my $dbh = eval { $schema->storage->_dbh }; + $dbh->do("DROP TABLE artist") if $dbh; + undef $schema; } -