X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F746mssql.t;h=6584050bb96dac22f0837eba0ed5fb4b3ad0fcfb;hb=4e0a89e400d865458081bc5af9e0eedf349f60de;hp=1438ceee5bb0f2ec49210be32ef1873a88409632;hpb=a54bd479dbbeb16e6641140586b626e5502ff631;p=dbsrgits%2FDBIx-Class.git diff --git a/t/746mssql.t b/t/746mssql.t index 1438cee..6584050 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -12,6 +12,11 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ODBC_${_}" } qw/DSN USER PA plan skip_all => 'Set $ENV{DBICTEST_MSSQL_ODBC_DSN}, _USER and _PASS to run this test' unless ($dsn && $user); +{ + my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version}; + ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') ); +} + DBICTest::Schema->load_classes('ArtistGUID'); my $schema = DBICTest::Schema->connect($dsn, $user, $pass); @@ -301,6 +306,7 @@ for my $dialect ( is ($limited_rs->count_rs->next, 6, "$test_type: Correct count_rs of limited right-sorted joined resultset"); my $queries; + my $orig_debug = $schema->storage->debug; $schema->storage->debugcb(sub { $queries++; }); $schema->storage->debug(1); @@ -312,7 +318,7 @@ for my $dialect ( is ($queries, 1, "$test_type: Only one query with prefetch"); $schema->storage->debugcb(undef); - $schema->storage->debug(0); + $schema->storage->debug($orig_debug); is_deeply ( [map { $_->name } ($limited_rs->search_related ('owner')->all) ], @@ -330,6 +336,7 @@ for my $dialect ( { prefetch => 'books', order_by => { -asc => \['name + ?', [ test => 'xxx' ]] }, # test bindvar propagation + group_by => [ map { "me.$_" } $schema->source('Owners')->columns ], # the literal order_by requires an explicit group_by rows => 3, # 8 results total unsafe_subselect_ok => 1, }, @@ -338,7 +345,10 @@ for my $dialect ( my ($sql, @bind) = @${$owners->page(3)->as_query}; is_deeply ( \@bind, - [ ([ 'me.name' => 'somebogusstring' ], [ test => 'xxx' ]) x 2 ], # double because of the prefetch subq + [ + $dialect eq 'Top' ? [ test => 'xxx' ] : (), # the extra re-order bind + ([ 'me.name' => 'somebogusstring' ], [ test => 'xxx' ]) x 2 # double because of the prefetch subq + ], ); is ($owners->page(1)->all, 3, "$test_type: has_many prefetch returns correct number of rows");