Revision 0ade2438
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
847 | 847 |
my $joins_needed = shift; |
848 | 848 |
sub { |
849 | 849 |
my ($col, $group) = @_; |
850 |
$renamed_columns{$col} ||= $col; |
|
851 |
|
|
852 | 850 |
my @coalesce_tokens = |
853 |
map { ($_->[1] || 'p.') . $_->[0] } |
|
851 |
map { ($_->[1] || 'p.') . $_->[0] }
|
|
854 | 852 |
grep { !$_->[2] || $joins_needed->{$_->[2]} } |
855 | 853 |
grep { $_->[0] eq $col } |
856 |
@column_override, |
|
857 |
[ $col, $table_prefix{$col} ]; |
|
854 |
@column_override, [ $col, $table_prefix{$col} ]; |
|
858 | 855 |
|
859 |
my $coalesce = scalar @coalesce_tokens > 1;
|
|
856 |
my $coalesce = scalar @coalesce_tokens > 1; |
|
860 | 857 |
return ($coalesce |
861 | 858 |
? sprintf 'COALESCE(%s)', join ', ', @coalesce_tokens |
862 | 859 |
: shift @coalesce_tokens) |
863 |
. ($group && $coalesce
|
|
864 |
? " AS $renamed_columns{$col}"
|
|
860 |
. ($group && ($coalesce || $renamed_columns{$col})
|
|
861 |
? " AS " . ($renamed_columns{$col} || $col)
|
|
865 | 862 |
: ''); |
866 | 863 |
} |
867 | 864 |
}; |
Auch abrufbar als: Unified diff
Und noch ein Bug: renamed columns