Module: tools
Branch: master
Commit: 50477068bc2a067180f1484bd923d2b6e972f8f4
URL: https://source.winehq.org/git/tools.git/?a=commit;h=50477068bc2a067180f1484…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Sat Apr 21 20:02:58 2018 +0200
testbot: Check $Item->{IsNew} before $Item->{IsModified}.
After creating a new item one normally modifies a number of fields. So
check whether the item is new before assuming we simply need to update it
just because IsModified is true.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/DBIBackEnd.pm | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/testbot/lib/ObjectModel/DBIBackEnd.pm b/testbot/lib/ObjectModel/DBIBackEnd.pm
index 40bfe85..ec1b450 100644
--- a/testbot/lib/ObjectModel/DBIBackEnd.pm
+++ b/testbot/lib/ObjectModel/DBIBackEnd.pm
@@ -515,26 +515,18 @@ sub SaveItem($$)
{
my ($self, $Item) = @_;
- my $Query;
- my ($MasterColNames, $MasterColValues) = $Item->GetMasterCols();
- if ($Item->GetIsModified())
- {
- $Query = $self->BuildUpdateStatement($Item->GetTableName(),
- $Item->GetPropertyDescriptors(),
- $MasterColNames);
- }
- elsif ($Item->GetIsNew())
+ if ($Item->GetIsNew())
{
die "Internal error: Need to save new items via collection";
}
- else
- {
- return;
- }
+ if (!$Item->GetIsModified());
+ my ($MasterColNames, $MasterColValues) = $Item->GetMasterCols();
+ my $Query = $self->BuildUpdateStatement($Item->GetTableName(),
+ $Item->GetPropertyDescriptors(),
+ $MasterColNames);
my $Statement = $self->GetDb()->prepare($Query);
$Statement->execute(@{$self->GetUpdateData($MasterColValues, $Item)});
-
$Statement->finish();
}
Module: tools
Branch: master
Commit: ed4208e634b2fa21d3a8d3580882976bb31f51d0
URL: https://source.winehq.org/git/tools.git/?a=commit;h=ed4208e634b2fa21d3a8d35…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Sat Apr 21 19:56:52 2018 +0200
Revert "testbot/web: Tweak ItemPage to save the Item directly.".
Saving the item directly is ok when modifying it, but DBIBackend only
supports saving new items through the collection. In particular the
registration web page depends on that so we have no choice but to go
through the collection.
This reverts commit c18379abe004411ca779d4c42e26d7e7f3d72ba6.
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/CGI/ItemPage.pm | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm
index c208aea..9b9f2ff 100644
--- a/testbot/lib/ObjectModel/CGI/ItemPage.pm
+++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm
@@ -134,16 +134,6 @@ sub SaveProperty($$$)
return 1;
}
-sub Save($)
-{
- my ($self) = @_;
-
- return !1 if (!$self->SaveProperties());
-
- ($self->{ErrField}, $self->{ErrMessage}) = $self->{Item}->Save();
- return ! defined($self->{ErrMessage});
-}
-
sub OnAction($$)
{
my ($self, $Action) = @_;