* Fixes
- Revert default selection to being lazy again (eagerness introduced
- in 0.08126) - fixes DBIx::Class::Helper::ResultSet::RemoveColumns
+ in 0.08125) - fixes DBIx::Class::Helper::ResultSet::RemoveColumns
+ - Fix losing order of columns provided in select/as (regression from
+ 0.08125)
- Unaliased "dark" selectors no longer throw off prefetch
- Fix proper composition of bind values across all possible
SQL areas ( group_by => \[ ... ] now works properly )
Roman: Roman Filippov <romanf@cpan.org>
+Sadrak: Felix Antonius Wilhelm Ostmann <sadrak@cpan.org>
+
sc_: Just Another Perl Hacker
scotty: Scotty Allen <scotty@scottyallen.com>
# if balanced - treat as a columns entry
$attrs->{"${pref}columns"} = $self->_merge_attr(
$attrs->{"${pref}columns"},
- { map { $as->[$_] => $sel->[$_] } ( 0 .. $#$as ) }
+ [ map { +{ $as->[$_] => $sel->[$_] } } ( 0 .. $#$as ) ]
);
}
else {
# disassemble columns
my (@sel, @as);
- for my $c (@{
- ref $attrs->{columns} eq 'ARRAY' ? $attrs->{columns} : [ $attrs->{columns} || () ]
- }) {
- if (ref $c eq 'HASH') {
- for my $as (keys %$c) {
- push @sel, $c->{$as};
- push @as, $as;
+ if (my $cols = delete $attrs->{columns}) {
+ for my $c (ref $cols eq 'ARRAY' ? @$cols : $cols) {
+ if (ref $c eq 'HASH') {
+ for my $as (keys %$c) {
+ push @sel, $c->{$as};
+ push @as, $as;
+ }
+ }
+ else {
+ push @sel, $c;
+ push @as, $c;
}
- }
- else {
- push @sel, $c;
- push @as, $c;
}
}
$crs->as_query,
'(SELECT COUNT( * )
FROM (
- SELECT MAX( cds.year ) AS newest_cd_year, me.artistid
+ SELECT me.artistid, MAX( cds.year ) AS newest_cd_year,
FROM artist me
LEFT JOIN cd cds ON cds.artist = me.artistid
GROUP BY me.artistid
is_same_sql_bind (
$most_tracks_rs->as_query,
'(
- SELECT me.maxtr, me.cdid, me.track_count,
+ SELECT me.cdid, me.track_count, me.maxtr,
tracks.trackid, tracks.cd, tracks.position, tracks.title, tracks.last_updated_on, tracks.last_updated_at,
liner_notes.liner_id, liner_notes.notes
FROM (
- SELECT MAX( tracks.trackid ) AS maxtr, me.cdid, COUNT( tracks.trackid ) AS track_count,
+ SELECT me.cdid, COUNT( tracks.trackid ) AS track_count, MAX( tracks.trackid ) AS maxtr
FROM cd me
LEFT JOIN track tracks ON tracks.cd = me.cdid
WHERE ( me.cdid IS NOT NULL )
'Correct chaining before attr resolution'
);
+# Test the order of columns
+$rs = $schema->resultset('CD')->search ({}, {
+ 'select' => [ 'me.cdid', 'me.title' ],
+});
+
+is_same_sql_bind (
+ $rs->as_query,
+ '( SELECT
+ me.cdid,
+ me.title
+ FROM cd me
+ )',
+ [],
+ 'Correct order of selected columns'
+);
+
done_testing;