L
Laura Stern
Guest
We can't evaluate the query string for QUERY-PREPARE until run-time. The value there is not a constant, it is a character expression. i.e., It can be the value of a variable or the return value of a function, or the result of a SUBSTRING function on a variable or a database field, etc, etc. Therefore, during the compilation of the .p/.cls, the compiler stores information in the r-code that allows us to evaluate the expression. But it knows nothing about what the expression's value is going to be. So yes, in the example above, which is a FOR EACH statement, the compiler would essentially store what you show (3rd field in the local var buffer). But for a QUERY-PREPARE all you have is a string whose value is: "WHERE relation.name = foo". Maybe that really came from a line of code that said: "qry:QUERY-PREPARE(whereClause)" where whereClause is a variable, and at run-time it evaluates to "WHERE relation.name = foo". Now the compiler has to evaluate this, and now it does not know what foo is.
Continue reading...
Continue reading...