C lib add-ins
Posted in 1991
Jim Gordon (jgordon@ssf-sys.dhl.com) writes:
> John writes in X-Informix-List-Id: <list.333>
> >They only support embedded SQL and a pre-processor.
[ ... deleted ... ]
> >They do not support direct C-Library calls, unfortunately.
[ ... deleted ... ]
> >I just wish it was more flexible.
>
> What other flexibility
[ over Informix ESQL/C, 4GL ]
> would you be looking for and why would a direct C Library help?
How 'bout something like
select foo
from bar
where dist(x1, y1, x2, y2) < some_number
dist() figures out how far P1 (x1,y1) is from P2 (x2, y2), and is part
of a C lib that you can add in. V. handy if you're doing anything
complex [sic]. Last time I saw this was in Empress RDBMS.
> From the little contact I have had with Esql/c it seems to me that the
> whole idea is that the programmer is protected from needing to know
> direct calls or how things are structured.
Yup, clean, plus the easy power of SQL and the invisible optimiser.
> The programmer is
> restricted to the SQL commands because otherwise he might?? be able
> to screw up the connection with the backend server.
Don't think so. ESQL/C will let you do some fairly hairy things,
otherwise a simple kill(3) or "tbmode -z $pid" will probably finish
things off.
> Presumably even
> with a direct library interface he wouldn't have any extra facilities
See above, as many as you like.
> so it seems to me that having a pre-processor allows the SQL to be
> kept as readable SQL statements so improving the general readability
> and maintainability of the code.
The back end parses the SQL normally, so it's kept as readable statements ?
Which is why I might do
LET stmt = "delete from foo where foobar = ? "
PREPARE id FROM stmt
FOR i = 1 TO 30
EXECUTE id USING tmpvar[i]
END FOR
rather than getting it parsed on every call. Course, if you supply
your own functions, the training and maintainability get much harder
but there are compensations (less code, more effect).
> Cheers,
>
> Jim
> --------------------------------------------------------------------
> Name: Jim Gordon Internet: jgordon@ssf-sys.DHL.COM
> Company: DHL Systems Inc Phone: (415) 358-5911
> Address: 1700 S. Amphlett Blvd. Fax: (415) 571-6429
> San Mateo, CA 94402
--
Cheers - Tony.
____________________________________________________________________________
Who: Tony Heskett | DHL Systems Ltd, Kings House,
How: theskett@lhr-sys.ssf-sys.dhl.com | Great West Road, Brentford, TW8 9HS
Vox: (+44) 81 747 8330 x 363 | Fax: (+44) 81 747 0875