Project

General

Profile

Feature #2086

add support for the VALIDATE clause, for the temp-table's fiels defined using LIKE clause

Added by Constantin Asofiei about 11 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Start date:
03/06/2013
Due date:
% Done:

60%

billable:
No
vendor_id:
GCD

ca_upd20130307h.zip (300 KB) Constantin Asofiei, 03/07/2013 04:55 PM

ca_upd20130308a.zip (300 KB) Constantin Asofiei, 03/08/2013 03:09 AM

ca_upd20130308c.zip (335 KB) Constantin Asofiei, 03/08/2013 07:27 AM

History

#1 Updated by Constantin Asofiei about 11 years ago

The server project exposed a problem with the temp-table fields defined using the LIKE clause, when the target field has validation. In 4GL, the VALIDATE clause forces the validation at the source field to be copied at the target field (and this was not honored at all by P2J). The problem in the server project was with a field definition like this:

def temp-table tt1 field f1 like person.schedule[1].

where if person.schedule had these clauses:
  VALEXP "length(input schedule[1]) > 0" 
  VALMSG "aa" 

the parser copied them to the tt1.f1 field. Later, during P2O generation, the rules somehow got confused by the fact that the valexp reference had a subscript operand and thought that the tt1.f1 was extent too. This was a tough one to crack, until I managed to isolate the code which produces the error.

The attached update fixes only the cases of "VALIDATE clause is not specified", by removing any VALEXP and VALMSG nodes. I did not test, but I think when the VALIDATE clause is specified and there is VALEXP at the source field, then the source field name needs to be replaced with the target field name, to make the validation expression work. And, IIRC from browsing the sources for other issues, the server project does use the VALIDATE clause. So, this task should remain open for discussion until we identify if LIKE ... VALIDATE is used by the server project.

This is going through conversion regression testing now.

#2 Updated by Constantin Asofiei about 11 years ago

MAJIC has finished conversion and there are changes, expected: validation clauses are dropped for temp-table fields defind using LIKE db-field without VALIDATE clause. Anyway, even if the validate has been there, the generated validation expressions are incorrect as they use the source field, instead of the temp-table field.

This can ben released to cleanup more compile errors, but more work is needed to fully support the VALIDATE clause - can you please run a report and confirm that is used?

#3 Updated by Greg Shah about 11 years ago

VALIDATE is NOT used in the server project (in a TEMP-TABLE or WORK-TABLE definition). Only NO-UNDO and RCODE-INFORMATION options are present.

Are there any cases in Majic?

#4 Updated by Constantin Asofiei about 11 years ago

Greg, the VALIDATE clause is used in the server project with a field definition. See file pmcon/cjcotdo0.w. There are compile failures in this file because of it (the exact case is similar to LIKE person.schedule[1] VALIDATE, assuming person.schedule has a validate clause), so more work is needed.

#5 Updated by Constantin Asofiei about 11 years ago

This fix removes the extent annotation from the source field reference in the VALEXP. What is still needed to do:
  1. remove the VALEXP/VALMSG nodes if the VALIDATE clause is not present in constructs like DEF TEMP-TABLE tt1 LIKE book.
  2. fix the source field references in the VALEXP to reference the new field.

With this update, I hope we can get past compile errors, but the final fix will need to solve the two issues above.

#6 Updated by Constantin Asofiei about 11 years ago

New version of the update, which solves the VALIDATE when used with DEFINE TEMP-TABLE tt1 LIKE source VALIDATE. Also, it rewrites any field references of the source node in the VALEXP, to reference the new node.

I will put this through conversion regression testing.

#7 Updated by Greg Shah about 11 years ago

Sorry, when you say "VALIDATE clause", I thought you are referring to the option for a TEMP-TABLE (not for a specific field). Field-level validation expressions are certainly in use.

#8 Updated by Constantin Asofiei about 11 years ago

The update has passed conversion regression testing. There is one additional change in MAJIC, from a DEFINE TEMP-TABLE tt1 LIKE book. change - as no VALIDATE clause is present, the validation expression was removed.

#9 Updated by Greg Shah about 11 years ago

OK, this change looks fine. Commit and distribute it.

#10 Updated by Constantin Asofiei about 11 years ago

Committed to bzr 10266.

#11 Updated by Greg Shah about 11 years ago

  • Status changed from WIP to Closed

#12 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 4 to Conversion Support for Server Features

Also available in: Atom PDF