[Bast-commits] r8035 - in
DBIx-Class/0.08/branches/mssql_rno_pagination: . t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Fri Dec 4 11:24:15 GMT 2009
Author: ribasushi
Date: 2009-12-04 11:24:13 +0000 (Fri, 04 Dec 2009)
New Revision: 8035
Modified:
DBIx-Class/0.08/branches/mssql_rno_pagination/Changes
DBIx-Class/0.08/branches/mssql_rno_pagination/t/746mssql.t
Log:
Tests for bindvar propagation and Changes
Modified: DBIx-Class/0.08/branches/mssql_rno_pagination/Changes
===================================================================
--- DBIx-Class/0.08/branches/mssql_rno_pagination/Changes 2009-12-04 11:07:56 UTC (rev 8034)
+++ DBIx-Class/0.08/branches/mssql_rno_pagination/Changes 2009-12-04 11:24:13 UTC (rev 8035)
@@ -1,5 +1,6 @@
Revision history for DBIx::Class
+ - Real limit/offset support for MSSQL server (via Row_Number)
- Fix distinct => 1 with non-selecting order_by (the columns
in order_by also need to be aded to the resulting group_by)
- Do not attempt to deploy FK constraints pointing to a View
Modified: DBIx-Class/0.08/branches/mssql_rno_pagination/t/746mssql.t
===================================================================
--- DBIx-Class/0.08/branches/mssql_rno_pagination/t/746mssql.t 2009-12-04 11:07:56 UTC (rev 8034)
+++ DBIx-Class/0.08/branches/mssql_rno_pagination/t/746mssql.t 2009-12-04 11:24:13 UTC (rev 8035)
@@ -275,15 +275,22 @@
# try a ->has_many direction
my $owners = $schema->resultset ('Owners')->search (
{
- 'books.id' => { '!=', undef }
+ 'books.id' => { '!=', undef },
+ 'me.name' => { '!=', 'somebogusstring' },
},
{
prefetch => 'books',
- order_by => 'name',
+ order_by => { -asc => \['name + ?', [ test => 'xxx' ]] }, # test bindvar propagation
rows => 3, # 8 results total
},
);
+ my ($sql, @bind) = @${$owners->page(3)->as_query};
+ is_deeply (
+ \@bind,
+ [ ([ 'me.name' => 'somebogusstring' ], [ test => 'xxx' ]) x 2 ], # double because of the prefetch subq
+ );
+
is ($owners->page(1)->all, 3, 'has_many prefetch returns correct number of rows');
is ($owners->page(1)->count, 3, 'has-many prefetch returns correct count');
@@ -299,6 +306,7 @@
},
{
distinct => 1,
+ having => \['1 = ?', [ test => 1 ] ], #test having propagation
prefetch => 'owner',
rows => 2, # 3 results total
order_by => { -desc => 'owner' },
@@ -307,6 +315,16 @@
},
);
+ ($sql, @bind) = @${$books->page(3)->as_query};
+ is_deeply (
+ \@bind,
+ [
+ # inner
+ [ 'owner.name' => 'wiggle' ], [ 'owner.name' => 'woggle' ], [ source => 'Library' ], [ test => '1' ],
+ # outer
+ [ 'owner.name' => 'wiggle' ], [ 'owner.name' => 'woggle' ], [ source => 'Library' ],
+ ],
+ );
is ($books->page(1)->all, 2, 'Prefetched grouped search returns correct number of rows');
is ($books->page(1)->count, 2, 'Prefetched grouped search returns correct count');
More information about the Bast-commits
mailing list