use Test::More;
use Test::Exception;
use Try::Tiny;
-use DBIx::Class::SQLMaker::LimitDialects;
-use DBIx::Class::Optional::Dependencies ();
-use lib qw(t/lib);
-use DBICTest;
-use DBIC::SqlMakerTest;
+use DBIx::Class::Optional::Dependencies ();
plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_mssql_odbc')
unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_mssql_odbc');
-my $OFFSET = DBIx::Class::SQLMaker::LimitDialects->__offset_bindtype;
-my $TOTAL = DBIx::Class::SQLMaker::LimitDialects->__total_bindtype;
+use lib qw(t/lib);
+use DBICTest;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_ODBC_${_}" } qw/DSN USER PASS/};
}
catch {
if ($opts{$opts_name}{required}) {
- BAIL_OUT "on_connect_call option '$opts_name' is not functional: $_";
+ die "on_connect_call option '$opts_name' is not functional: $_";
}
else {
skip
is ($limited_rs->count, 6, "$test_type: Correct count of limited right-sorted joined resultset");
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);
-
- is_deeply (
- [map { $_->owner->name } ($limited_rs->all) ],
- [@owner_names[2 .. 7]],
- "$test_type: Prefetch-limited rows were properly ordered"
- );
- is ($queries, 1, "$test_type: Only one query with prefetch");
-
- $schema->storage->debugcb(undef);
- $schema->storage->debug($orig_debug);
+ $schema->is_executed_querycount( sub {
+ is_deeply (
+ [map { $_->owner->name } ($limited_rs->all) ],
+ [@owner_names[2 .. 7]],
+ "$test_type: Prefetch-limited rows were properly ordered"
+ );
+ }, 1, "$test_type: Only one query with prefetch" );
is_deeply (
[map { $_->name } ($limited_rs->search_related ('owner')->all) ],
},
);
- my ($sql, @bind) = @${$owners->page(3)->as_query};
- # not testing the SQL as it is quite different between top/rno
- is_same_bind (
- \@bind,
- [
- [ { dbic_colname => 'test' }
- => 'xxx' ],
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'me.name' }
- => 'somebogusstring' ],
-
- ($dialect eq 'Top'
- ? [ { dbic_colname => 'test' } => 'xxx' ] # the extra re-order bind
- : ([ $OFFSET => 7 ], [ $TOTAL => 9 ]) # parameterised RNO
- ),
-
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'me.name' }
- => 'somebogusstring' ],
- [ { dbic_colname => 'test' }
- => 'xxx' ],
- ],
- );
-
is ($owners->page(1)->all, 3, "$test_type: has_many prefetch returns correct number of rows");
is ($owners->page(1)->count, 3, "$test_type: has-many prefetch returns correct count");
},
);
- ($sql, @bind) = @${$books->page(3)->as_query};
- # not testing the SQL as it is quite different between top/rno
- is_same_bind (
- \@bind,
- [
- # inner
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'owner.name' }
- => 'wiggle' ],
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'owner.name' }
- => 'woggle' ],
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' }
- => 'Library' ],
- [ { dbic_colname => 'test' }
- => '1' ],
-
- # rno(?)
- $dialect ne 'Top' ? ( [ $OFFSET => 5 ], [ $TOTAL => 6 ] ) : (),
- # outer
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'owner.name' }
- => 'wiggle' ],
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'owner.name' }
- => 'woggle' ],
- [ { sqlt_datatype => 'varchar', sqlt_size => 100, dbic_colname => 'source' }
- => 'Library' ],
- ],
- );
-
is ($books->page(1)->all, 2, "$test_type: Prefetched grouped search returns correct number of rows");
is ($books->page(1)->count, 2, "$test_type: Prefetched grouped search returns correct count");