[Dbix-class] quote char works with sorting without breaking too much!
Jesper Krogh
jesper at krogh.cc
Wed Jun 21 10:31:57 CEST 2006
This patch makes quote_char and order by work without breaking "too much".
As castaway cleverly pointed out, then it wont work when columnnames have
spaces in them.
Suggestion for a permanent fix was to make order_by take an array_ref:
->search({},{order_by => [ { "this.that" => "desc"},{"this.id" => "asc"}]});
This can be implemneted without breaking the current order_by that only
takes a scalar as argument.. Is this viable?
... this it not the patch to do the above... but to make it semi-work now.
Index: lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- lib/DBIx/Class/Storage/DBI.pm (revision 2013)
+++ lib/DBIx/Class/Storage/DBI.pm (working copy)
@@ -193,7 +193,7 @@
map { $self->{quote_char}->[0] . $_ . $self->{quote_char}->[1] }
split(/\Q$sep\E/,$label));
}
- return $self->SUPER::_quote($label);
+ return join(" ",map { $_ !~ /^(asc|desc)$/i ? $self->SUPER::_quote($_)
: $_ } split(" ",$label));
}
sub _RowNum {
Jesper
--
Jesper Krogh
More information about the Dbix-class
mailing list