[tools 2/2] testbot: Provide read-only access to the master columns.

Francois Gouget fgouget at codeweavers.com
Tue Apr 26 12:35:58 CDT 2022


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 at codeweavers.com>
---
This depends on the patch that provides the speedup + read access to
the Itemref columns.

The end goal is actually the entire elimination (hopefully) of the 
master columns. This patch makes it possible to start replacing 
GetMasterKey() / GetMasterCols() calls with direct access to the 
corresponding columns.
---
 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 d47238182..7d36ffa38 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;
-- 
2.30.2



More information about the wine-devel mailing list