[tools] testbot/orm: Fix multi-column key support in Item::Compare().
Francois Gouget
fgouget at codeweavers.com
Fri Jun 3 12:22:51 CDT 2022
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
I think that so far this issue has been masked by the MasterColumns.
---
testbot/lib/ObjectModel/Item.pm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/testbot/lib/ObjectModel/Item.pm b/testbot/lib/ObjectModel/Item.pm
index 7d36ffa38..0b1da92a2 100644
--- a/testbot/lib/ObjectModel/Item.pm
+++ b/testbot/lib/ObjectModel/Item.pm
@@ -422,22 +422,27 @@ sub Compare($$)
{
my $ColName = $ColNames->[0];
my $ColType = $PropertyDescriptor->GetType();
- return ($ColType eq "N" or $ColType eq "S" or $ColType eq "DT") ?
- $self->{ColValues}{$ColName} <=> $B->{ColValues}{$ColName} :
- $self->{ColValues}{$ColName} cmp $B->{ColValues}{$ColName};
+ my $Cmp = ($ColType eq "N" or $ColType eq "S" or $ColType eq "DT") ?
+ $self->{ColValues}{$ColName} <=> $B->{ColValues}{$ColName} :
+ $self->{ColValues}{$ColName} cmp $B->{ColValues}{$ColName};
+ return $Cmp if ($Cmp);
}
- if ($PropertyDescriptor->GetClass() eq "Enum")
+ elsif ($PropertyDescriptor->GetClass() eq "Enum")
{
my $ColName = $ColNames->[0];
- return $self->{ColValues}{$ColName} cmp $B->{ColValues}{$ColName};
- }
-
- # A Detailref cannot be a key so this is an Itemref
- foreach my $ColName (@$ColNames)
- {
my $Cmp = $self->{ColValues}{$ColName} cmp $B->{ColValues}{$ColName};
return $Cmp if ($Cmp);
}
+ else
+ {
+ # A Detailref cannot be a key so this is an Itemref. Note that its
+ # underlying column types are unknown so treat them as strings.
+ foreach my $ColName (@$ColNames)
+ {
+ my $Cmp = $self->{ColValues}{$ColName} cmp $B->{ColValues}{$ColName};
+ return $Cmp if ($Cmp);
+ }
+ }
}
return 0;
}
--
2.30.2
More information about the wine-devel
mailing list