Project

General

Profile

Bug #7841

Invalid conversion of temp table DMO when using clob/blob fields

Added by Alexandru Donica almost 3 years ago. Updated 4 months ago.

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

100%

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

start.p Magnifier (115 Bytes) Alexandru Donica, 09/26/2023 08:52 AM

table-blob.p Magnifier (869 Bytes) Alexandru Donica, 09/26/2023 08:52 AM

table-clob.p Magnifier (746 Bytes) Alexandru Donica, 09/26/2023 08:52 AM

History

#2 Updated by Alexandru Donica almost 3 years ago

I created 2 temp tables, in separate procedures, with the same table name, same field types with same field names, but one of them had a field 'lob' with type blob, and the other table had one with type clob. AFAIK, FWD tries to combine temp-tables with similar enough fields so as to not create many classes. However, FWD combined the 2 temp tables I created in a single class, but with only 1 of the 'lob' fields. The lob type seemed to depend on which of the 4GL procedures/files was converted last.

If the file with the clob was converted last, the Java class would have the 'lob' field as a clob. A clob managed to somewhat replace a blob in the example below, however, when exporting the lob to a file, it would use the writeClob() method in FileStream instead of writeBlob(). I imaged other discrepancies could arise with more testing (maybe when using a memptr/longchar).

To change the order of conversion for each file, i renamed one to be alphabetically before/after the other file. (like table-clob.p -> atable-clob.p).
The name must also be changed in the start.p file. If the file with the blob was converted last, in my example, after conversion, the program would try to assign a clob variable to a blob field, and would not even compile.

I used the method copy_lob from 4GL to take the value from a longchar into a blob. For a clob, I simply assigned it the value of a longchar.

#3 Updated by Alexandru Donica almost 3 years ago

Sorry, there is a typo in the file start.p, where I forgot to rename the procedure atable-clob.p to table-clob.p.
Either delete the letter 'a' or rename the file table-clob.p to atable-clob.p before running the code.

#4 Updated by Alexandru Lungu 5 months ago

  • Assignee set to Stefanel Pezamosca

#5 Updated by Stefanel Pezamosca 5 months ago

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

I took a quick look here and found this in rules/include/common-progress.rules -> <function name="create_temp_table_key_criteria">

         <!-- establish temp table comparison criteria -->
         <rule>tmpTabCrit = create('java.util.HashMap')</rule>
[...]
         <rule>tmpTabCrit.put(prog.field_int, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_int64, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_dec, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_date, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_datetime, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_datetime_tz, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_char, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_logical, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_raw, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_recid, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_rowid, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_handle, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_class, tmpTabProps)</rule>
I think it needs to have field_clob and field_blob in here as well:
         <rule>tmpTabCrit.put(prog.field_blob, tmpTabProps)</rule>
         <rule>tmpTabCrit.put(prog.field_clob, tmpTabProps)</rule>
I tested this and it fixed the testcase.

#6 Updated by Stefanel Pezamosca 5 months ago

  • % Done changed from 90 to 100
  • Status changed from WIP to Review
  • reviewer Constantin Asofiei added

Created branch 7841a from trunk/16448.
Committed fix in 7841a revision 16449.

#7 Updated by Constantin Asofiei 5 months ago

Stefanel, please add also field_com_handle there - this is the only one which is still missing.

Also, do a search for field_datetime_tz - there are other places I think were we need to add clob/blob/etc, like in annotations/accumulate.rules

#8 Updated by Stefanel Pezamosca 5 months ago

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

Sure, I’ll check.

#9 Updated by Stefanel Pezamosca 5 months ago

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

Added other missing field_clob, field_blob and field_com_handle in accumulate.rules, frame_generator.xml, common-progress.rules.

#10 Updated by Constantin Asofiei 5 months ago

  • Status changed from Review to Internal Test

Thanks, can be queued for testing.

#11 Updated by Stefanel Pezamosca 4 months ago

I forgot about this, the regression testing has passed for 7841a.
I think we can merge this.

#12 Updated by Alexandru Lungu 4 months ago

  • Status changed from Internal Test to Merge Pending

Please merge this to trunk now.

#13 Updated by Stefanel Pezamosca 4 months ago

  • Status changed from Merge Pending to Test

Branch 7841a was merged into trunk as rev. 16487 and archived.

Also available in: Atom PDF