X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F74mssql.t;h=172c78dfbb329b2fd76a69a319c58285c561fb24;hb=8a0720e2d4a3914c84ac2ce1dd5913d5931709a1;hp=a3c2cc01caa9e020922220d3f3ded9c7d01e0ba8;hpb=c29ce31779a99ead1195746f213889162bee17cb;p=dbsrgits%2FDBIx-Class.git diff --git a/t/74mssql.t b/t/74mssql.t index a3c2cc0..172c78d 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -18,7 +18,7 @@ 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; @@ -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