Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!sun-barr!cs.utexas.edu!uunet!cimshop!davidm From: davidm@cimshop.UUCP (David Masterson) Newsgroups: comp.databases Subject: Re: SQL-schema to C generation Message-ID: <454@cimshop.UUCP> Date: 4 Aug 89 17:40:17 GMT References: <1910007@hpmcaa.mcm.hp.com> Organization: Consilium Mt. View CA Lines: 28 In-reply-to: nacer@hpmcaa.mcm.hp.com's message of 3 Aug 89 19:03:16 GMT >Before the schema becomes stable every time it is modified the >corresponding C declarations need to be updated manually I would like >to know if there is a stand-alone SQL-schema to C declaration >translator. ... >Has any body used or attempted a similar automation? >Can one use awk to produce such a tool? > The closest thing I've seen that is supported is VAX/VMS CDD+. It is a data dictionary product that will read the database and understand the declarations of all tables there in. VAX C (amongst the other VAX languages) has hooks in it that allow it to ask the data dictionary for the current definition of tables within the database. However, this should be a fairly trivial thing to develop through AWK and the like. All the information that is needed should be in the relational database's data dictionary. All that is needed is to develop an appropriate query to get the information out and then a shell script to massage the information into C syntax. The hard part would be how to make it automatic so that MAKE could recognize definitions as having changed and rebuild the code appropriately. A possibility there would be to have MAKE always execute this shell script, then DIFF the output with the previous output and only continue if there are differences. Just make sure that the script produces one file for each table in the database (so you don't MAKE everything if only one table changed). David Masterson uunet!cimshop!davidm or DMasterson@cup.portal.com