Module: tools Branch: master Commit: f89000e0bddce36ecb2fd9d9775936147a34d8d6 URL: https://source.winehq.org/git/tools.git/?a=commit;h=f89000e0bddce36ecb2fd9d9...
Author: Francois Gouget fgouget@codeweavers.com Date: Tue Apr 26 19:35:58 2022 +0200
testbot: Provide read-only access to the master columns.
This allows accessing these columns directly regardless of how the Item was loaded: straight from the database or through a Detailref relation. In the latter case this also simplifies accessing these columns greatly.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/lib/ObjectModel/Item.pm | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/testbot/lib/ObjectModel/Item.pm b/testbot/lib/ObjectModel/Item.pm index d472381..7d36ffa 100644 --- a/testbot/lib/ObjectModel/Item.pm +++ b/testbot/lib/ObjectModel/Item.pm @@ -72,6 +72,14 @@ sub new($$@) $self->{PropertyDescriptors} = $Collection->{PropertyDescriptors}; $self->{MasterColNames} = $Collection->{MasterColNames}; $self->{MasterColValues} = $Collection->{MasterColValues}; + # Provide read-only access to the master column values + if ($self->{MasterColNames}) + { + foreach my $ColIndex (0..$#{$self->{MasterColNames}}) + { + $self->{ColValues}->{$self->{MasterColNames}->[$ColIndex]} = $self->{MasterColValues}->[$ColIndex]; + } + } $self->{MasterKey} = ObjectModel::Collection::ComputeMasterKey($self->{MasterColValues}); $self->{IsNew} = 1; $self->{IsModified} = !1;