Project

General

Profile

Bug #10611

Incorrect abbreviation name resolved at conversion time

Added by Eduard Soltan 10 months ago. Updated 6 months ago.

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

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

History

#1 Updated by Eduard Soltan 10 months ago

I have the following test case:

DEFINE TEMP-TABLE Main NO-UNDO
    FIELD Main_id  AS RECID XML-NODE-TYPE "HIDDEN":U.

DEFINE TEMP-TABLE Second NO-UNDO NAMESPACE-URI "http://www.openapplications.org/oagis/10":U
    FIELD Main_id AS RECID XML-NODE-TYPE "HIDDEN":U.

DEFINE TEMP-TABLE Third NO-UNDO NAMESPACE-URI "http://www.openapplications.org/oagis/10":U
    FIELD Main_id_id AS RECID XML-NODE-TYPE "HIDDEN":U.

DEFINE DATASET dsProcessField  XML-NODE-TYPE "HIDDEN":U
    FOR Main, Second, Third
    PARENT-ID-RELATION FOR Main, Second PARENT-ID-FIELD Main_id
    PARENT-ID-RELATION FOR Main, Third  PARENT-ID-FIELD Main_id.

create Main.

create Third.
Third.Main_i = recid(Main).

release Third.
release Main.

In OE this code does compile, and correct relationship field is picked Main_id_id.

In FWD, the wrong PARENT-ID-FIELD is picked at conversion time:

final DataSet dsProcessField = DataSetManager.define("dsProcessField", false, false)
         .setDefiningType(Start.class)
         .setXmlNodeType("HIDDEN")
         .forBuffers(main, second, third)
         .addParentIdRelation("ParentRelation1", main, second, "main_id")
         .addParentIdRelation("ParentRelation2", main, third, "main_id")
         .generate();

I guess the real problem here is that while parsing PARENT-ID-FIELD Main_id phrase we try to infer the the table used in the child relationship just with field name. And in this case the abbreviation name matches the name of the Second field name.

I think to solve the problem we need to set the currentRecord while parsing PARENT-ID-RELATION FOR phrase in for_parent_relation_spec.

#4 Updated by Eduard Soltan 10 months ago

  • Status changed from New to WIP
  • % Done changed from 0 to 100

Committed solution on 10611a, rev. 16180.

#5 Updated by Eduard Soltan 10 months ago

  • Status changed from WIP to Review
  • reviewer Constantin Asofiei added

#6 Updated by Constantin Asofiei 10 months ago

  • Status changed from Review to Internal Test
  • Assignee set to Eduard Soltan

I'll put this into testing with other apps, but a simple flag change to now look for abbreviated names instead of exact may have more implications than intended.

#7 Updated by Constantin Asofiei 10 months ago

  • % Done changed from 100 to 50
  • Status changed from Internal Test to WIP

This one fails the #9457 project, with 9457c.

#8 Updated by Eduard Soltan 6 months ago

I have put a conversion with 10611a of 9457 application, and manage to create a small test case.

def temp-table tt1 field f1 as char
                   field f2 as char
                   field f3 as char.

def temp-table tt2 field f3_abc as char
                   field f3_asd as char
                   field tt1_recid as recid.

define dataset dtt for tt1, tt2
       PARENT-ID-RELATION FOR tt1, tt2 PARENT-ID-FIELD tt1_recid
                                       PARENT-FIELDS-BEFORE (f1, f2, f3).

I have looked over the Progress documentation:

PARENT-ID-RELATION FOR parent-buffer-name, child-buffer-name

PARENT-FIELDS-BEFORE ( parent-field1[ , parent-field2]... )
    An optional phrase that specifies the fields from the parent-buffer-name temp-table record that are to be written to XML or JSON before any child-buffer-name temp-table records.

According to documentation, PARENT-FIELDS-BEFORE statement should included only fields from parent-buffer-name buffer (tt1 in our case).

The error that I get is:

'f3' is ambiguous; 2 matches found [tt2.f3_asd, tt2.f3_abc]
     [java]     at com.goldencode.p2j.schema.Namespace.findUnambiguously(Namespace.java:656)
     [java]     at com.goldencode.p2j.schema.Namespace.find(Namespace.java:528)
     [java]     at com.goldencode.p2j.schema.Namespace.find(Namespace.java:465)
     [java]     at com.goldencode.p2j.schema.SchemaDictionary.findFieldNode(SchemaDictionary.java:4603)

In this case FWD looks for field name in child-buffer-name buffer which is incorrect according to the docs.

So I think that 10611a exposed a existent problem in FWD, I will look into that.

#9 Updated by Eduard Soltan 6 months ago

10611a, rev. 16181 has a fix for #10611-8, I have converted #9457 application and it now passes.

#10 Updated by Eduard Soltan 6 months ago

  • Status changed from WIP to Review
  • % Done changed from 50 to 100

#11 Updated by Eduard Soltan 6 months ago

def temp-table tt1 field f1 as int.
                   //field b as int.

def temp-table tt2 field b1 as int
                   field b2 as int.

def var h as handle.

create query h.
h:SET-BUFFERS (buffer tt1:handle, buffer tt2:handle).

h:QUERY-PREPARE ("for each tt1 where f1 = 10, first tt2 where b = 5").
h:query-open().

I have found a case in customer application, where a search for abbreviated field name will cause an error. Search for b field name for tt2 buffer will raise an ambiguous error (it can't decide between b1 and b2 field names). I think raising of the error should be postponed, until all scopes of the query has been searched.

Committed on 10611a, rev. 16182.

Also available in: Atom PDF