Project

General

Profile

Bug #5799

write-xml doesn't serialize the prods:id attributes and the deleted fields for before-table

Added by Constantin Asofiei over 2 years ago. Updated over 2 years ago.

Status:
Feedback
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

Related issues

Related to Base Language - Feature #3310: add support for the equivalent of the OpenEdge Web Services Adapter (and ProxyGen) and PASOE SOAP transport Closed

History

#1 Updated by Constantin Asofiei over 2 years ago

This program:

@openapi.openedge.export FILE(type="REST", executionMode="external", useReturnValue="false", writeDataSetBeforeImage="true").
block-level on error undo, throw.
define temp-table ttOrder no-undo
    before-table bttOrder
    field orderNum  as integer
    field orderName as character.

define dataset dsOutputBT
    for ttOrder.

define var input_orderNum as integer no-undo.
define var input_orderName as character no-undo.
input_orderNum = 1.
input_orderName = "Toto".

create ttOrder.
assign
    ttOrder.orderName = input_orderName
    ttOrder.orderNum  = input_orderNum.

create ttOrder.
assign
    ttOrder.orderName = input_orderName
    ttOrder.orderNum  = input_orderNum - 100.

temp-table ttOrder:tracking-changes = true.

//update
find ttOrder where ttOrder.orderNum = input_orderNum.
ttOrder.orderName = substitute ('Modified &1',input_orderName).
//add new
create ttOrder.
assign
    ttOrder.orderName = substitute ('New &1',input_orderName)
    ttOrder.orderNum  = input_orderNum + 100.

// delete
for each ttOrder where ttOrder.orderNum = input_orderNum - 100:
    delete ttOrder.
end.  

dataset dsoutputbt:write-xml("file", "dso.xml", yes, ?, ?, no, ?, true, ?).

must produce this file:
<?xml version="1.0"?>
<prods:datasetChanges xmlns:prods="urn:schemas-progress-com:xml-dataset-changes:0001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <dsOutputBT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ttOrder prods:id="ttOrder12544" prods:rowState="modified">
      <orderNum>1</orderNum>
      <orderName>Modified Toto</orderName>
    </ttOrder>
    <ttOrder prods:id="ttOrder12546" prods:rowState="created">
      <orderNum>101</orderNum>
      <orderName>New Toto</orderName>
    </ttOrder>
  </dsOutputBT>
  <prods:before>
    <ttOrder prods:id="ttOrder10498">
      <orderNum>-99</orderNum>
      <orderName>Toto</orderName>
    </ttOrder>
    <ttOrder prods:id="ttOrder12544">
      <orderNum>1</orderNum>
      <orderName>Toto</orderName>
    </ttOrder>
  </prods:before>
</prods:datasetChanges>

In FWD, it writes this:

<?xml version='1.0'?>
<dsOutputBT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <prods:datasetChanges xmlns:prods="urn:schemas-progress-com:xml-dataset-changes:0001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <dsOutputBT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <ttOrder>
        <orderNum>1</orderNum>
        <orderName>Modified Toto</orderName>
      </ttOrder>
      <ttOrder>
        <orderNum>101</orderNum>
        <orderName>New Toto</orderName>
      </ttOrder>
    </dsOutputBT>
    <prods:before>
      <ttOrder prods:id="ttOrder1">
        <orderNum>1</orderNum>
        <orderName>Toto</orderName>
      </ttOrder>
    </prods:before>
  </prods:datasetChanges>
</dsOutputBT>

Note how the before table is missing the deleted field and the after-table is missing the prods attributes.

#2 Updated by Constantin Asofiei over 2 years ago

  • Related to Feature #3310: add support for the equivalent of the OpenEdge Web Services Adapter (and ProxyGen) and PASOE SOAP transport added

#3 Updated by Ovidiu Maxiniuc over 2 years ago

  • % Done changed from 0 to 100
  • Assignee set to Ovidiu Maxiniuc
  • Status changed from New to Feedback
As you noted, there were two issues here:
  • WRITE-XML was not serializing the prods:id and prods:rowState attributes. This was disabled from code because they were exposed in other cases. I am not aware when these attributes are serialized exactly. It might depend on the dataset/table internal configuration rather than the parameters of WRITE-XML. I guess it's better to have them extra than the lack of them;
  • the deleted records were not serialized. The problem here was that they did not exist in database and, in fact they were not created at all. This is because FWD analysed the delete code and detected a possible optimization by bulk deleting the records directly in SQL. Doing so, the before table is not populated with the expected records. I disabled the optimization for tables with change-tracking active and the issue is gone. The other temp-tables can be fast deleted as before.

However, there is another thing that I see: FWD wraps the serialized dataset in an additional wrapper: <prods:datasetChanges ...>. Obviously, this was implemented as result of my observations while working with various testcases. Same like the prods attributes above, I am unable to tell what dictates whether they are output to XML stream. Is this (additional node) OK for your use case?

Committed revision 13126.

Also available in: Atom PDF