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@codeweavers.com --- 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 40bfe85f7..ec1b45037 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(); }