Project

General

Profile

Feature #9542

finish ORIGIN-HANDLE ProDataSet attribute

Added by Eric Faulhaber over 1 year ago. Updated 11 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:

Related issues

Related to Database - Feature #9544: implement missing SESSION handle attributes Test

History

#1 Updated by Eric Faulhaber over 1 year ago

Missing attributes:

  • <table_handle>:ORIGIN-HANDLE (none/none)

#2 Updated by Ovidiu Maxiniuc over 1 year ago

Actually the support for this attribute is 90% implemented. What is missing is the 'reset'. It seems like the rules/gaps/expressions.rules is not up-to-date.
Here is a testcase:

define temp-table src1 like book.
create src1.
    src1.book-id = 10.
    src1.book-title = "Tom Sailer".
    src1.publisher = "RAFT Publishing".
    src1.isbn = "123-12-1234-123-456".
    src1.cost = 21.35.
    src1.price = 21.57.
    src1.pub-date = today - 1234.
    src1.author-id = 1010.
release src1.

define temp-table tt1 like book before-table bt1.
define dataset ds1 for tt1.
define data-source dsrc1 for src1.
buffer tt1:attach-data-source(data-source dsrc1:handle).
dataset ds1:fill.
message 1 temp-table tt1:handle
          temp-table bt1:handle
          temp-table src1:handle.

temp-table tt1:tracking-changes = yes.
buffer tt1:find-first().
tt1.book-title = "Hop-Top".
buffer tt1:buffer-release().
temp-table tt1:tracking-changes = no.

define variable chg as handle.
create dataset chg.
chg:create-like(dataset ds1:handle).
chg:get-changes(dataset ds1:handle).
message 3 chg:get-buffer-handle(1):table-handle:ORIGIN-HANDLE.

// dataset ds1:EMPTY-DATASET(). -- no change here
chg:EMPTY-DATASET().
chg:get-buffer-handle(1):EMPTY-TEMP-TABLE().
message 4 chg:get-buffer-handle(1):table-handle:ORIGIN-HANDLE.
The output should be something like:
1 1000 1001 1002
3 1000
4 ?
but it is:
1 1000 1001 1002
3 1000
4 1000
The difference is on last line, FWD does not reset the handle to unknown value ? when the dataset/temp-table is cleared using EMPTY-DATASET() or EMPTY-TEMP-TABLE() methods.

Actually, there is a comment in Dataset.emptyDataset() which documents the deviation.

The following patch fixes the issue:

--- old/src/com/goldencode/p2j/persist/AbstractTempTable.java
+++ new/src/com/goldencode/p2j/persist/AbstractTempTable.java
@@ -987,6 +987,7 @@
       }

       deleteAllImpl();
+      originTable = null; 

       return logical.of(true);
    }

--- old/p2j/rules/gaps/expressions.rules
+++ new/p2j/rules/gaps/expressions.rules
@@ -247,6 +247,7 @@
 ** 067 HC  20240630 Implemented support for WEB-FILE-UPLOAD statement.
 ** 068 EM  20241220 Implemented support for SESSION:STREAM.
 ** 069 DMM 20250129 Implemented support for RCODE-INFO:MD5-VALUE.
+** 070 OM  20250204 Updated gap info for ORIGIN-HANDLE.
 */
  -->

@@ -1388,7 +1389,7 @@
          <rule>attrs.put(prog.kw_ole_naml, rw.cvt_lvl_none       | rw.rt_lvl_none)</rule> <!-- undocumented, found in possenet appbuilder source code -->
          <rule>attrs.put(prog.kw_on_fr_b , rw.cvt_lvl_none       | rw.rt_lvl_stub)</rule> <!-- on-frame-border -->
          <rule>attrs.put(prog.kw_ordinal,  rw.cvt_lvl_full       | rw.rt_lvl_full)</rule> <!-- ordinal -->
-         <rule>attrs.put(prog.kw_org_hand, rw.cvt_lvl_none       | rw.rt_lvl_none)</rule> <!-- origin-handle -->
+         <rule>attrs.put(prog.kw_org_hand, rw.cvt_lvl_full       | rw.rt_lvl_full)</rule> <!-- origin-handle -->
          <rule>attrs.put(prog.kw_org_roid, rw.cvt_lvl_full       | rw.rt_lvl_full)</rule> <!-- origin-rowid -->
          <rule>attrs.put(prog.kw_overlay , rw.cvt_lvl_full       | rw.rt_lvl_full)</rule>
          <rule>attrs.put(prog.kw_own_doc , rw.cvt_lvl_full       | rw.rt_lvl_full)</rule>

#3 Updated by Ovidiu Maxiniuc over 1 year ago

One more thing:

In Ref manual, the attribute is reported as:

Access: Read-only
FWD respects that and raises ** ORIGIN-HANDLE is not a setable attribute for TEMP-TABLE widget. (4052).

However, in my test, I added the following lines at the end of the test:

chg:get-buffer-handle(1):table-handle:ORIGIN-HANDLE = 
    chg:get-buffer-handle(1):table-handle.

message 5 chg:get-buffer-handle(1):table-handle:ORIGIN-HANDLE.
and 4GL reported:
5 1003

#4 Updated by Greg Shah over 1 year ago

  • Subject changed from implement missing ProDataSet attributes to finish ORIGIN-HANDLE ProDataSet attribute

#5 Updated by Greg Shah over 1 year ago

  • Related to Feature #9544: implement missing SESSION handle attributes added

#6 Updated by Greg Shah over 1 year ago

  • Assignee set to Ovidiu Maxiniuc
  • Status changed from New to Review
  • reviewer Eric Faulhaber, Greg Shah added

Code Review Task Branch 9544a Revision 15689

I saw the changes from this task were added to 9544a.

I see no issue with the changes, except that the history number 071 in expressions.rules is not needed (both entries should be under history number 070).

Eric: Please review.

#7 Updated by Greg Shah over 1 year ago

  • % Done changed from 0 to 100

#8 Updated by Ovidiu Maxiniuc over 1 year ago

  • Status changed from Review to Test

Branch 9544a which contains the changes from this task was merged into trunk as r15725 and then was archived.

#9 Updated by Eric Faulhaber 11 months ago

Ovidiu, the gap markings for prog.kw_first_bu and prog.kw_first_qr both have the comment "not heavily tested". Do you know if this is still the case? I'm trying to determine whether we can consider them sufficiently tested and close this task.

#10 Updated by Ovidiu Maxiniuc 11 months ago

The implementations for these two APIs have 2 years now and they are unchanged ever since. I think we should consider them as stable ATM, even if firstBuffer() has a TODO note that specifies that BUFFER resources might be reported in a different order than assumed at the moment of implementation. That is an usual assumption for 99.9% of methods ported from 4GL, nothing out of the ordinary.

Also available in: Atom PDF