[Catalyst-commits] r10526 - in
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk: .
lib/CatalystX/CRUD/Model lib/CatalystX/CRUD/Object t
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Sat Jun 13 17:59:46 GMT 2009
Author: karpet
Date: 2009-06-13 17:59:45 +0000 (Sat, 13 Jun 2009)
New Revision: 10526
Modified:
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm
CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/t/01-rdbo.t
Log:
release 0.21
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2009-06-13 00:45:05 UTC (rev 10525)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/Changes 2009-06-13 17:59:45 UTC (rev 10526)
@@ -73,3 +73,7 @@
* switch to MRO::Compat from Class::C3
* fixes for CatalystX::CRUD 0.43
+0.21 13 June 2009
+ * fix multiple ORDER BY columns with comma-join (see RT 46904)
+ * explicitly call ->delegate->meta to fix moosification issue with Catalyst 5.8x
+
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2009-06-13 00:45:05 UTC (rev 10525)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Model/RDBO.pm 2009-06-13 17:59:45 UTC (rev 10526)
@@ -8,7 +8,7 @@
use Carp;
use Data::Dump qw( dump );
-our $VERSION = '0.20';
+our $VERSION = '0.21';
__PACKAGE__->mk_ro_accessors(
qw( name manager treat_like_int load_with related_load_with ));
@@ -412,8 +412,8 @@
my ( $self, $obj, $rel_name, $fk_val ) = @_;
my $meta = $self->_get_rel_meta( $obj, $rel_name );
- my $obj_method
- = $obj->delegate->meta->column_accessor_method_name( $meta->{map_from}->[1] );
+ my $obj_method = $obj->delegate->meta->column_accessor_method_name(
+ $meta->{map_from}->[1] );
my $query = [
$meta->{map_from}->[0] => $obj->$obj_method,
$meta->{map_to}->[0] => $fk_val,
@@ -476,8 +476,8 @@
sub _join_with_table_prefix {
my ( $self, $q, $prefix ) = @_;
- return join( ' ',
- map { $prefix . '.' . $_->[0], $_->[1] }
+ return join( ', ',
+ map { $prefix . '.' . $_->[0] . ' ' . $_->[1] }
map { [%$_] } @{ $q->{sort_order} } );
}
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2009-06-13 00:45:05 UTC (rev 10525)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/lib/CatalystX/CRUD/Object/RDBO.pm 2009-06-13 17:59:45 UTC (rev 10526)
@@ -3,7 +3,7 @@
use warnings;
use base qw( CatalystX::CRUD::Object );
-our $VERSION = '0.20';
+our $VERSION = '0.21';
=head1 NAME
Modified: CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/t/01-rdbo.t
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/t/01-rdbo.t 2009-06-13 00:45:05 UTC (rev 10525)
+++ CatalystX-CRUD/CatalystX-CRUD-Model-RDBO/trunk/t/01-rdbo.t 2009-06-13 17:59:45 UTC (rev 10526)
@@ -1,4 +1,4 @@
-use Test::More tests => 20;
+use Test::More tests => 22;
BEGIN {
use lib qw( ../../CatalystX-CRUD/trunk/lib );
@@ -13,7 +13,8 @@
use Data::Dump qw( dump );
use HTTP::Request::Common;
-diag("testing against Catalyst-Runtime version " . $Catalyst::Runtime::VERSION);
+diag( "testing against Catalyst-Runtime version "
+ . $Catalyst::Runtime::VERSION );
ok( my $res = request('/foo/test'), "get /foo/test" );
@@ -44,15 +45,17 @@
ok( $res = request('/foo/search?id=1&cxc-order=id'),
"search id=1 with order" );
-is( $res->content, qq/{
- limit => 50,
- offset => 0,
- plain_query => { id => [1] },
- plain_query_str => "(id='1')",
- query => ["id", 1],
- sort_by => "t1.id ASC",
- sort_order => [{ id => "ASC" }],
-}/, "search query with order dir assumed"
+is_deeply(
+ eval $res->content,
+ { limit => 50,
+ offset => 0,
+ plain_query => { id => [1] },
+ plain_query_str => "(id='1')",
+ query => [ "id", 1 ],
+ sort_by => "t1.id ASC",
+ sort_order => [ { id => "ASC" } ],
+ },
+ "search query with order dir assumed"
);
#dump $res;
@@ -62,27 +65,49 @@
#dump $res;
-is( $res->content, qq/{
- limit => 50,
- offset => 0,
- plain_query => { id => [1] },
- plain_query_str => "(id='1')",
- query => ["id", 1],
- sort_by => "t1.id DESC",
- sort_order => [{ id => "DESC" }],
-}/, "search query with explicit order/dir"
+is_deeply(
+ eval $res->content,
+ { limit => 50,
+ offset => 0,
+ plain_query => { id => [1] },
+ plain_query_str => "(id='1')",
+ query => [ "id", 1 ],
+ sort_by => "t1.id DESC",
+ sort_order => [ { id => "DESC" } ],
+ },
+ "search query with explicit order/dir"
);
ok( $res = request('/foo/search?id=1'), "search id=1 with no sort" );
-is( $res->content, qq/{
- limit => 50,
- offset => 0,
- plain_query => { id => [1] },
- plain_query_str => "(id='1')",
- query => ["id", 1],
- sort_by => "t1.id DESC",
- sort_order => [{ id => "DESC" }],
-}/, "search query with default PK order"
+is_deeply(
+ eval $res->content,
+ { limit => 50,
+ offset => 0,
+ plain_query => { id => [1] },
+ plain_query_str => "(id='1')",
+ query => [ "id", 1 ],
+ sort_by => "t1.id DESC",
+ sort_order => [ { id => "DESC" } ],
+ },
+ "search query with default PK order"
);
-#dump $res;
+# test multiple sort
+ok( $res = request('/foo/search?id=1&cxc-order=id+desc+name+asc'),
+ "search id=1 with 2-column sort" );
+
+#dump $res->content;
+
+is_deeply(
+ eval $res->content,
+ { limit => 50,
+ offset => 0,
+ plain_query => { id => [1] },
+ plain_query_str => "(id='1')",
+ query => [ "id", 1 ],
+ sort_by => "t1.id desc, t1.name asc",
+ sort_order => [ { id => "desc" }, { name => "asc" } ],
+ },
+ "multi-sort content"
+);
+
More information about the Catalyst-commits
mailing list