Project

General

Profile

Bug #3065

runtime conversion datatype checks

Added by Ovidiu Maxiniuc about 8 years ago. Updated about 8 years ago.

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

0%

billable:
No
vendor_id:
GCD
case_num:
version:

History

#1 Updated by Ovidiu Maxiniuc about 8 years ago

In the static conversion P2J assumes that the input 4GL code is always correct. When it comes to dynamic conversions of query predicates this is not always true because the code could be badly generated to even manually typed in by the user. Beside the evident bad-syntax errors, the other important source of dynamic errors is datatype incompatibility.
In these cases, P2J should emit error 5729 Incompatible datatypes found during runtime conversion and stop processing (like P4GL does).

Some incompatibilities are handled on-the-fly by (some, if not all) database engine. So strings containing numbers, logicals or iso date values are implicitly casted to their respective type literals. We need to check all implicit castings the P4GL does and if not done by the database in background, we need to explicit convert them. Some work for a particular case (empty strings) was done in #3001.

If the P4GL cannot handle the implicit casting, the 5729 should occur. Note that in a normal flow a programmer will call QUERY-PREPARE(), QUERY-OPEN() and GET-NEXT() methods, in this order. Although p2 will probably be able to identify these error in QUERY-PREPARE(), we need to delay reporting the error until GET-NEXT() method gets called, as P4GL does.

Also available in: Atom PDF