Subject Re: [Firebird-Architect] precompilers
Author Frank Schlottmann-Gödde
Stephen Boyd schrieb:
> I know that the subject of embedded SQL precompilers is considered
> passe and that the mere mention of the subject elicits massive yawns
> from all concerned, but ...

I fear there are not so many left who know about precompilers or have
seen a working cobol program :-)

> To implement the new precompiler I would ignore gpre completely and
> start with a blank slate. The new precompiler would not create the
> BLR for the ESQL statements but would rather make calls to a new
> subroutine library that would use the database engine to compile the
> ESQL statements as needed and return / retrieve the column values
> from a fixed format "record" buffer, the format of which would be
> determined by the precompiler. Sensible values would be substituted
> for NULL columns by the subroutine library. For example:
>
> EXEC SQL SELECT LD_LOCATION, LD_LOAD_NUMBER, LD_LOAD_SUFFIX FROM
> LOADS;
>
> would generate something like this:
>
> WORKING-STORAGE SECTION. 01 SELECT1-SQL. 03 FILLER PIC X(??)
> "SELECT LD_LOCATION, LD_LOAD_NUMBER, LD_LOAD_SUFFIX FROM LOADS". 01
> LOADS. 03 LD-LOCATION PIC X(6). 03 LD-LOAD-NUMBER PIC 9(6). 03
> LD-LOAD-SUFFIX PIC X(2).
>
> PROCEDURE DIVISION. CALL "FBLIB" USING SQLCODE, SELECT1-SQL, LOADS.

...


> I fully understand that this will not be as efficient as the code
> currently generated by gpre since the SQL statements will have to be
> compiled at run time rather than at compile time. And I will have to
> provide routines to convert from Firebird data types to the host
> language data types and vice versa.
>
> I appreciate any and all comments about this approach. Is it
> workable or am I completely out to lunch?

It sounds workable to me, but it's 8 years ago since I looked at gpre
and I've only a very limited understanding of cobol.

> What have I not
> considered? You could probably write a book on that topic.

I hope you get some more helpful answers after the summer holidays.

Frank

--
"Fascinating creatures, phoenixes, they can carry immensely heavy loads,
their tears have healing powers and they make highly faithful pets."
- J.K. Rowling