10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Arraysfor i = custtable.FirstRow to custtable.LastRow doif custtable[i]._rowstate = RS_DELETED thenrepeated delete from customer where acctno =:cust_table[i].acctno;elseif custtable[i]._rowstate = RS_NEW thenrepeated insert into customer ...elseif custtable[i]._rowstate = RS_CHANGED thenrepeated update customer...endif;commit;/*Reset rowstate to prevent handling this row** again on next Save unless data changes** again. */custtable[i]._RowState = RS_UNCHANGED;endfor;Fence Diagram for Row States and TransitionsThe following illustration summarizes the effects of programming statementsand user actions on array row states:• The vertical lines represent the starting and ending row states.• The arrows are labeled to indicate the statement or action that causes thestate to change.• The numbers in parentheses to the right of each row state indicate thenumeric value of the row state constants.The following statements illustrate a few possibilities:• If a user opens a new row by selecting the Insert New Row operation of adefault control button, the row state changes from nonexistent toRS_UNDEFINED.– If the user changes the newly inserted row, the row state changesfrom RS_UNDEFINED to RS_NEW.– If the 4GL code makes an assignment to the newly inserted row, therow state does not change; therefore the arrow in the fence diagrambegins and ends at the same position.• If a row with a row state of RS_NEW is deleted, its row state becomesnonexistent.• If a row with a row state of RS_UNCHANGED is deleted, its row statebecomes RS_DELETED.214 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!