Skip to content

Commit

Permalink
RT81485: sorting keys to account for new Perl hash randomization in P…
Browse files Browse the repository at this point in the history
…erl 5.17.6
  • Loading branch information
damil committed Nov 30, 2012
1 parent 58b8368 commit 801655c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/SQL/Abstract/More.pm
Expand Up @@ -298,10 +298,10 @@ sub insert {
# is interpreted as .. RETURNING ... INTO ...
if (my $returning = $args{-returning}) {
if (does($returning, 'HASH')) {
my @keys = keys %$returning
my @keys = sort keys %$returning
or croak "-returning => {} : the hash is empty";
push @old_API_args, {returning => \@keys};
$returning_into = [values %$returning];
$returning_into = [@{$returning}{@keys}];
}
else {
push @old_API_args, {returning => $returning};
Expand Down Expand Up @@ -406,7 +406,7 @@ sub merge_conditions {

foreach my $cond (@_) {
if (does($cond, 'HASH')) {
foreach my $col (keys %$cond) {
foreach my $col (sort keys %$cond) {
$merged{$col} = $merged{$col} ? [-and => $merged{$col}, $cond->{$col}]
: $cond->{$col};
}
Expand Down Expand Up @@ -540,7 +540,7 @@ sub _single_join {

# build result and return
my %result = (sql => $sql, bind => \@bind);
$result{name} = ($self->{join_assoc_right} ? $left : $right)->{name};
$result{name} = ($self->{join_assoc_right} ? $left : $right)->{name};
$result{aliased_tables} = $left->{aliased_tables};
foreach my $alias (keys %{$right->{aliased_tables}}) {
$result{aliased_tables}{$alias} = $right->{aliased_tables}{$alias};
Expand Down
2 changes: 1 addition & 1 deletion t/01-sql_abstract_more.t
Expand Up @@ -473,7 +473,7 @@ is_same_sql_bind(
);
is_same_sql_bind(
$sql, \@bind,
'INSERT INTO Foo(bar, foo) VALUES (?, ?) RETURNING k2, k1 INTO ?, ?',
'INSERT INTO Foo(bar, foo) VALUES (?, ?) RETURNING k1, k2 INTO ?, ?',
[2, 1, \$k2, \$k1],
);

Expand Down

0 comments on commit 801655c

Please sign in to comment.