[Jifty-commit] jifty-dbi branch, master, updated. 0.74-2-gf9439a0
Jifty commits
jifty-commit at lists.jifty.org
Fri Apr 20 04:05:49 EDT 2012
The branch, master has been updated
via f9439a0aec4d065c22bfe8f8e40a049621a71d6f (commit)
from ff41d9d15694bda0d3ee08d9bec57d1ecd0a5020 (commit)
Summary of changes:
lib/Jifty/DBI/Handle/Pg.pm | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit f9439a0aec4d065c22bfe8f8e40a049621a71d6f
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Apr 20 16:05:27 2012 +0800
backport a sort order fix from Searchbuilder
diff --git a/lib/Jifty/DBI/Handle/Pg.pm b/lib/Jifty/DBI/Handle/Pg.pm
index 7b413eb..178fdc7 100755
--- a/lib/Jifty/DBI/Handle/Pg.pm
+++ b/lib/Jifty/DBI/Handle/Pg.pm
@@ -210,6 +210,7 @@ sub distinct_query {
map {
my $alias = $_->{alias} || '';
my $column = $_->{column};
+ my $order = $_->{order};
if ($column =~ /\W/) {
warn "Possible SQL injection in column '$column' in order_by\n";
next;
@@ -218,7 +219,7 @@ sub distinct_query {
( ( !$alias or $alias eq 'main.' ) and $column eq 'id' )
? $_
- : { %{$_}, column => undef, function => "min($alias$column)" }
+ : { %{$_}, column => undef, function => ($order =~ /^des/i ? 'MAX':'MIN'). "($alias$column)" }
} @{ $collection->{order_by} }
];
my $group = $collection->_group_clause;
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list