Bug #11048
Temp-table wrong SERIALIZE-NAME when using same DMO
100%
History
#1 Updated by Teodor Gorghe 7 months ago
Suppose we have the following project, with 2 files, pTestDsTTLegacyName.p and pTestDsTTLegacyName2.p:
- pTestDsTTLegacyName.p
DEFINE TEMP-TABLE ttNAME NO-UNDO FIELD f1 AS INTEGER. DISPLAY BUFFER ttNAME:SERIALIZE-NAME.
- pTestDsTTLegacyName2.p
DEFINE TEMP-TABLE ttName NO-UNDO FIELD f1 AS INTEGER. DISPLAY BUFFER ttName:SERIALIZE-NAME.
- dmo/_temp/Ttname_1.java
- dmo/_temp/Ttname_1_1.java
- PTestDsTtlegacyName.java
- PTestDsTtlegacyName2.java
- dmo/_meta/* (not relevant for this issue)
- ui/* (not relevant for this issue)
When running each procedure, the output should be:
ttNAME ttName
but FWD outputs this:
ttName ttName
The SERIALIZE-NAME implementation uses the DmoInfo instance which contains the cached value from DMO definition.
Since the DMO interface is common because the definition is the same, but the _name() or legacyName is not. The value for legacyName from DmoInfo is either ttNAME or ttName, but the last converted file gives the final legacy name (in this case, ttName).
#3 Updated by Teodor Gorghe 7 months ago
- Status changed from New to WIP
- Assignee set to Teodor Gorghe
Created task branch 11048a.
#4 Updated by Teodor Gorghe 7 months ago
- % Done changed from 0 to 100
- Status changed from WIP to Review
- reviewer Constantin Asofiei added
Committed revision 16322 on task branch 11048a:
- SERIALIZE-NAME implementation should use the _name() instead of the legacyName.
#5 Updated by Constantin Asofiei 7 months ago
Please post how the TemporaryBuffer.define looks for the two tables.
#6 Updated by Teodor Gorghe 7 months ago
PTestDsTtlegacyName: Ttname_1_1.Buf ttname = TemporaryBuffer.define(Ttname_1_1.Buf.class, "ttname", "ttNAME", false, false);
PTestDsTtlegacyName2: Ttname_1_1.Buf ttname = TemporaryBuffer.define(Ttname_1_1.Buf.class, "ttname", "ttName", false, false);
#7 Updated by Constantin Asofiei 7 months ago
Thanks. The change makes sense then.
Please check also:BufferImpl.getTable()- error messages in
BufferImpl.bufferFieldand overloads - other cases where
DmoMeta.legacyTableis used and it should be the real legacy buffer name.
#8 Updated by Constantin Asofiei 7 months ago
Please create more tests using an explicit DEFINE BUFFER and see what happens.
I have a feeling we may need to create separate DMOs to keep the legacy table name intact.
#9 Updated by Ovidiu Maxiniuc 7 months ago
The problem is that 4GL is case insensitive from the PoV of identifiers. Therefore ttNAME and ttName are identical (if they would be encountered in same source file). FWD honours this and will reuse the table definition.
However, the problem is at metadata level. Even both these tables behave basically identical, the metadata is slightly different. I/we do not know where the legacy name is stored in 4GL compiled procedure, but in FWD converted Java code, it is found in the @Table class annotation. Once the class is read and loaded in memory, the interface is processed and the DmoMeta object is constructed. Usually when a metadata information is needed, this is the place to search for.
To fix the problem without creating additional class we could use the table definition. This is the only place where the table legacy name is preserved. The downside is that this is not directly/easy accessible to all places. As a matter of fact, the (default) buffer should have the name attribute (BufferImpl.name, actually inherited from HandleChain) set to right value. Therefore, I think changing the SERIALIZE-NAME implementation to pick its default value from the table's default buffer instead of DmoMeta object should fix the issue.
#10 Updated by Ovidiu Maxiniuc 7 months ago
Teodor,
I looked at the new branch and the code looks is OK to me. Please drop line 5110 since dmoInfo local variable is no longer needed.
However, note Constantin's recommendation to test a non-default buffer, additionally, maybe one with custom SERIALIZE-NAME. I do not think the change in conversion is necessary, but finer new adjustments of BufferImpl.getSerializeName().
#11 Updated by Teodor Gorghe 7 months ago
I will put this into the highest priority for tomorrow.
#12 Updated by Teodor Gorghe 7 months ago
Committed revision 16323 on task branch 11048a:
- Fixed regression from 16322.
- BUFFER-FIELD(INTEGER) should use the buffer NAME attribute.
I have used this code for testing: pTestDsTTLegacyName.p
#13 Updated by Ovidiu Maxiniuc 7 months ago
- Status changed from Review to Internal Test
I think the r16323 is fine. To note that getTable() will still return dmoInfo.legacyTable in case of permanent tables, but that is not a problem.
I appreciate that you took care of other locations where the table legacy name is needed. These places need to be tested as well.
#14 Updated by Teodor Gorghe 6 months ago
Rebased to trunk rev 16358
#15 Updated by Constantin Asofiei 6 months ago
Merge to trunk after 10956a
#16 Updated by Teodor Gorghe 6 months ago
- Status changed from Internal Test to Test
Branch 11048a was merged to trunk rev. 16390 and archived.
#17 Updated by Constantin Asofiei 6 months ago
- Status changed from Test to Closed