Project

General

Profile

Bug #6688

ASSIGN trigger conversion when field has DECIMALS clause

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

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

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:

History

#2 Updated by Constantin Asofiei almost 2 years ago

  • Assignee set to Ovidiu Maxiniuc

There is a problem when converting a runtime ASSIGN database trigger, with a field having DECIMALS and/or INITIAL clause, like this:

ADD FIELD "price" OF "orderline" AS decimal 
  FORMAT "->>,>>9.99" 
  INITIAL "0" 
  POSITION 30
  MAX-WIDTH 18
  DECIMALS 3
  ORDER 3

with this 4GL code:
on assign of orderline.price old value old_price do:
   message old_price.
end.

gets converted to:
registerDatabaseTrigger(0, 3, DatabaseEventType.ASSIGN, Orderline.Buf.class, "price", TriggerBlock0.class, Trig.this, false, true);

The root cause is that the conversion is injecting INITIAL/DECIMALS options at the "old" field:

        <ast col="30" id="257698037772" line="1" text="old" type="KW_OLD">
          <annotation datatype="java.lang.String" key="name" value="old_price"/>
          <annotation datatype="java.lang.Long" key="type" value="386"/>
          <annotation datatype="java.lang.String" key="format" value="&quot;-&gt;&gt;,&gt;&gt;9.99&quot;"/>
          <annotation datatype="java.util.ArrayList" key="initial">
            <listitem datatype="java.lang.Double" value="0.0"/>
          </annotation>
          <annotation datatype="java.lang.Long" key="decimals" value="3"/>
          <annotation datatype="java.lang.Boolean" key="vardef" value="true"/>
          <annotation datatype="java.lang.String" key="vardef-byrule" value="fixups/post_parse_fixups.xml:329"/>
          <annotation datatype="java.lang.String" key="javaname" value="oldPrice"/>
          <annotation datatype="java.lang.String" key="javaname-byrule" value="annotations/variable_definitions.rules:218"/>
          <annotation datatype="java.lang.String" key="classname" value="decimal"/>
          <annotation datatype="java.lang.String" key="classname-byrule" value="annotations/variable_definitions.rules:372"/>
          <annotation datatype="java.lang.String" key="format_constant" value="FMT_STR_1"/>
          <annotation datatype="java.lang.String" key="format_constant-byrule" value="annotations/format_string.rules:158"/>
          <annotation datatype="java.lang.Boolean" key="promote" value="true"/>
          <annotation datatype="java.lang.String" key="promote-byrule" value="annotations/scope_promotion.rules:312"/>
          <annotation datatype="java.lang.String" key="param_name" value="_oldPrice"/>
          <annotation datatype="java.lang.String" key="param_name-byrule" value="convert/variable_definitions.rules:1917"/>
          <ast col="40" id="257698037776" line="1" text="old_price" type="SYMBOL"/>
          <ast col="0" id="257698037778" line="0" text="FORMAT" type="KW_FORMAT">
            <annotation datatype="java.lang.String" key="define_constant" value="FMT_STR_1"/>
            <annotation datatype="java.lang.String" key="define_constant-byrule" value="annotations/format_string.rules:146"/>
            <annotation datatype="java.lang.Long" key="peerid" value="261993005118"/>
            <annotation datatype="java.lang.String" key="peerid-byrule" value="convert/variable_definitions.rules:1553"/>
            <ast col="0" id="257698037779" line="0" text="expression" type="EXPRESSION">
              <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
              <annotation datatype="java.lang.String" key="support_level-byrule" value="gaps/gap_analysis_marking.xml:435"/>
              <ast col="0" id="257698037780" line="0" text="&quot;-&gt;&gt;,&gt;&gt;9.99&quot;" type="STRING">
                <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
                <annotation datatype="java.lang.String" key="support_level-byrule" value="gaps/gap_analysis_marking.xml:435"/>
                <annotation datatype="java.lang.Long" key="peerid" value="261993005120"/>
                <annotation datatype="java.lang.String" key="peerid-byrule" value="convert/literals.rules:1127"/>
              </ast>
            </ast>
          </ast>
          <ast col="0" id="257698037781" line="0" text="INITIAL" type="KW_INIT">
            <ast col="0" id="257698037782" line="0" text="0" type="NUM_LITERAL">
              <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
              <annotation datatype="java.lang.String" key="support_level-byrule" value="gaps/gap_analysis_marking.xml:435"/>
              <annotation datatype="java.lang.Boolean" key="use64bit" value="false"/>
              <annotation datatype="java.lang.String" key="use64bit-byrule" value="annotations/cleanup.rules:464"/>
              <annotation datatype="java.lang.Long" key="peerid" value="261993005121"/>
              <annotation datatype="java.lang.String" key="peerid-byrule" value="convert/literals.rules:861"/>
            </ast>
          </ast>
          <ast col="0" id="257698037783" line="0" text="DECIMALS" type="KW_DECIMALS">
            <ast col="0" id="257698037784" line="0" text="3" type="NUM_LITERAL">
              <annotation datatype="java.lang.Long" key="support_level" value="16400"/>
              <annotation datatype="java.lang.String" key="support_level-byrule" value="gaps/gap_analysis_marking.xml:435"/>
              <annotation datatype="java.lang.Boolean" key="use64bit" value="false"/>
              <annotation datatype="java.lang.String" key="use64bit-byrule" value="annotations/cleanup.rules:464"/>
              <annotation datatype="java.lang.Long" key="peerid" value="261993005122"/>
              <annotation datatype="java.lang.String" key="peerid-byrule" value="convert/literals.rules:861"/>
            </ast>
          </ast>
        </ast>

#3 Updated by Ovidiu Maxiniuc almost 2 years ago

With 3821c your testcases correctly converts to

         registerDatabaseTrigger(DatabaseEventType.ASSIGN, OrderLine.Buf.class, "price", TriggerBlock0.class, P63481.this, false, true);

This was fixed recently r14123/3821c. I assume the issue occur in a parallel branch. Let me know if you can rebase otherwise I will merge the changes to this branch.

#4 Updated by Constantin Asofiei almost 2 years ago

Ovidiu Maxiniuc wrote:

With 3821c your testcases correctly converts to
[...]

This was fixed recently r14123/3821c. I assume the issue occur in a parallel branch. Let me know if you can rebase otherwise I will merge the changes to this branch.

Thanks, I'll rebase 6129a from 3821c and I'll test again.

#5 Updated by Constantin Asofiei almost 2 years ago

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

Constantin Asofiei wrote:

Ovidiu Maxiniuc wrote:

With 3821c your testcases correctly converts to
[...]

This was fixed recently r14123/3821c. I assume the issue occur in a parallel branch. Let me know if you can rebase otherwise I will merge the changes to this branch.

Thanks, I'll rebase 6129a from 3821c and I'll test again.

I've brought the changes in 3821c/14123 to 6129a/14272, to fix the ASSIGN db trigger literal problems.

Also available in: Atom PDF