triggers and C functions/programs???
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity, Platform-Specific Issues, Jobs, Consulting & Announcements
Hi, I'm very new to Informix (but I do have some Oracle) and I got a problem that I could solve with Oracle 8. Background ---------- I'm dealing with a program which in constructed in a *very* limited environment. However, the program uses an Informix database for its data source and manipulations. What I want is a way to trigger a C function/program on a row being inserted or updated in the Informix database. The function/program would do its action (credit card validation in this case) and store the results back into the database. Is this possible with Informix and triggers/stored procs? Can I add external C routines to the stored proc language (I assume the 4GL is the language)? And can someone recommend a good book for learning how to develope Informix applications of this nature? (Or maybe a FAQ too?) Or any ideas of a better way? [BTW, I don't think there is a way to add external C routines to the original program.] TIA, Dan -- Dan Miner dminer@nyx.net | | Doing Programmer/ | | Linux Linux Consultant | "What yonder light Windows 95 breaks?" | since http://www.nyx.net/~dminer/ | "Free software: The New Frontier" | v0.12
Dan Miner wrote: > Hi, > I'm very new to Informix (but I do have some Oracle) and I got a > problem that I could solve with Oracle 8. > Background > ---------- > I'm dealing with a program which in constructed in a *very* limited > environment. However, the program uses an Informix database > for its data source and manipulations. > What I want is a way to trigger a C function/program on a row > being inserted or updated in the Informix database. The > function/program would do its action (credit card validation > in this case) and store the results back into the database. > Is this possible with Informix and triggers/stored procs? > Can I add external C routines to the stored proc language (I assume > the 4GL is the language)? > And can someone recommend a good book for learning how to develope > Informix applications of this nature? (Or maybe a FAQ too?) > Or any ideas of a better way? [BTW, I don't think there is a way > to add external C routines to the original program.] You can only do what you want to do directly with the Universal Data Option which is the equivalent of Oracle 8. Indirectly you can, from SPL (Stored Procedure Language), launch a stand alone ESQL/C or 4GL program that will take input from its command line or a file, validate the credit, and insert/update the database itself using the SYSTEM keyword. You cannot write callable functions in any language for IDS 7.xx only for UDO 9.xx. Art S. Kagel
Dan Miner wrote: > > Hi, > > I'm very new to Informix (but I do have some Oracle) and I got a > problem that I could solve with Oracle 8. > > Background > ---------- > > I'm dealing with a program which in constructed in a *very* limited > environment. However, the program uses an Informix database > for its data source and manipulations. > > What I want is a way to trigger a C function/program on a row > being inserted or updated in the Informix database. The > function/program would do its action (credit card validation > in this case) and store the results back into the database. > > Is this possible with Informix and triggers/stored procs? > Can I add external C routines to the stored proc language (I assume > the 4GL is the language)? > > And can someone recommend a good book for learning how to develope > Informix applications of this nature? (Or maybe a FAQ too?) > > Or any ideas of a better way? [BTW, I don't think there is a way > to add external C routines to the original program.] Dan, without getting into the probable overkill of datablades, you can have a trigger call a stored procedure. Within the SP you can piece together a shell command sring and use the SYSTEM command to execute it. Big caveat: In executing the SYSTEM command the engine spawns a new shell running as user informix but no login. Hence, it has PATH or any other environment variable set. It is advisable that you write a script that sets the environment and then executes the program you really wanted to run. The SYSTEM command would execute this program with a full path name. HMmm.. Maybe a datablade is not such overkill after all.. -- -- Jake (Retrospectively realizes there is no future in hindsight) +------------------------------------------------------------+ | The expedient performance of a task with excessive concern | | regarding its duration-to-completion engenders a virtual | | certainty of diminished benefit therefrom. | | -- Benjamin Franklin (but he said it in 3 words) | +------------------------------------------------------------+