X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F74mssql.t;h=172c78dfbb329b2fd76a69a319c58285c561fb24;hb=8a0720e2d4a3914c84ac2ce1dd5913d5931709a1;hp=55d599f17efb7c19cabf945c9911a1fef7a9d097;hpb=7379eb67caa3d3d551fddca0c0d183820b57f3dc;p=dbsrgits%2FDBIx-Class.git diff --git a/t/74mssql.t b/t/74mssql.t index 55d599f..172c78d 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -18,13 +18,13 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test' unless ($dsn); -my $TESTS = 13; +my $TESTS = 15; plan tests => $TESTS * 2; my @storage_types = ( - 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server', - 'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars', + 'DBI::Sybase::Microsoft_SQL_Server', + 'DBI::Sybase::Microsoft_SQL_Server::NoBindVars', ); my $storage_idx = -1; my $schema; @@ -35,7 +35,7 @@ for my $storage_type (@storage_types) { $schema = DBICTest::Schema->clone; if ($storage_idx != 0) { # autodetect - $schema->storage_type($storage_type); + $schema->storage_type("::$storage_type"); } $schema->connection($dsn, $user, $pass); @@ -48,7 +48,7 @@ for my $storage_type (@storage_types) { next; } - isa_ok($schema->storage, $storage_type); + isa_ok($schema->storage, "DBIx::Class::Storage::$storage_type"); # start disconnected to test reconnection $schema->storage->_dbh->disconnect; @@ -103,12 +103,10 @@ for my $storage_type (@storage_types) { my ($storage, $dbh) = @_; eval { $dbh->do("DROP TABLE money_test") }; $dbh->do(<<'SQL'); - CREATE TABLE money_test ( id INT IDENTITY PRIMARY KEY, amount MONEY NULL ) - SQL }); @@ -120,19 +118,42 @@ SQL $row = $rs->create({ amount => 100 }); } 'inserted a money value'; - is $rs->find($row->id)->amount, 100, 'money value round-trip'; + cmp_ok $rs->find($row->id)->amount, '==', 100, 'money value round-trip'; lives_ok { $row->update({ amount => 200 }); } 'updated a money value'; - is $rs->find($row->id)->amount, 200, 'updated money value round-trip'; + cmp_ok $rs->find($row->id)->amount, '==', 200, + 'updated money value round-trip'; lives_ok { $row->update({ amount => undef }); } 'updated a money value to NULL'; - is $rs->find($row->id)->amount, undef,'updated money value to NULL round-trip'; + is $rs->find($row->id)->amount, + undef, 'updated money value to NULL round-trip'; + + $rs->create({ amount => 300 }) for (1..3); + + # test multiple active statements + lives_ok { + my $artist_rs = $schema->resultset('Artist'); + while (my $row = $rs->next) { + my $artist = $artist_rs->next; + } + $rs->reset; + } 'multiple active statements'; + + # test multiple active statements in a transaction + TODO: { + local $TODO = 'needs similar FreeTDS fixes to the ones in Sybase.pm'; + lives_ok { + $schema->txn_do(sub { + $rs->create({ amount => 400 }); + }); + } 'simple transaction'; + } } # clean up our mess