Skip to content

bug: missing error (return code) for unknown fields #94

Open

Description

@GitMensch

given

           EXEC SQL  FETCH SOMETHING INTO :FIELD END-EXEC.
      *
           IF SQLCODE = 0

resulted in

OCESQL*    EXEC SQL  FETCH SOMETHING INTO :FIELD END-EXEC.
OCESQL     CALL "OCESQLStartSQL"
OCESQL     END-CALL
      *
           IF SQLCODE = 0

The reason in this case was that FIELD was not contained in the variables visible to the parser (copybook instead of SQL INCLUDE, possibly because of missing support for #91).
The code generation should raise a clear error here "unknown bind variable :FIELD".

... rechecking the code - this happens here:

com_sprintf(buff,sizeof(buff), "OCESQL%5sCALL \"OCESQLStartSQL\"\nOCESQL%5sEND-CALL\n"," "," ");
fputs(buff, outfile);
host_list = list->host_list;
int count = 0;
if(host_list){
iret = gethostvarianttype(host_list->hostreference, &type, &digits, &scale);
if(iret != 0){
printmsg("%s:%d\n", host_list->hostreference,iret);
memset(buff, 0, sizeof(buff));
com_sprintf(buff,sizeof(buff), "E%03d",iret);
printerrormsg(host_list->hostreference, host_list->lineno,
buff);
return;

and there is indeed an output:

00234:E001:FIELD is not defined in the working-storage !

... but as ocesql still returns 0 and the message is placed to stdout this is easy to miss

Activity

  1. changed the title [-]bug: missing error for unkown fields[/-] [+]bug: missing error (return code) for unknown fields[/+] on Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions