forking a process and grabbing web site data from a C trigger?
От | Louis-David Mitterrand |
---|---|
Тема | forking a process and grabbing web site data from a C trigger? |
Дата | |
Msg-id | 20000815110705.A3616@styx обсуждение исходный текст |
Список | pgsql-hackers |
On Sat, Aug 12, 2000 at 01:10:01PM -0400, Tom Lane wrote: > Louis-David Mitterrand <cunctator@apartia.ch> writes: > >> IMPORTANT: changing the backend's locale on-the-fly is an EXTREMELY > >> DANGEROUS thing to do, and I strongly recommend that you find another > >> way to solve your problem. > > > The "problem" I am trying to solve is to send e-mail notifications to > > auction bidders in their own language with the proper number formatting, > > etc. From what you are saying I'll probably have to move these > > notifications to the mod_perl layer of the application. > > Well, you could fork a subprocess to issue the mail and change locale > only once you're safely inside the subprocess. Could you give a minimal example of how forking a subprocess in a PG trigger is done? Or maybe give a pointer to an existing example? On an unrelated subject I have to maintain and update a table containing currency rates for the auction site (URL in .sig): Table "currency" Attribute | Type | Modifier -----------+--------+-------------------- USD | float4 | not null default 1 FRF | float4 | AUD | float4 | CAD | float4 | EUR | float4 | GBP | float4 | DEM | float4 | JPY | float4 | CHF | float4 | To update it I wrote a quick perl script that grabs data from Yahoo's currency web page (attached). This script has to be installed and run as a cron job, but I'd like to integrate that functionality in the DB backend as a trigger that performs the data refresh every n'th SELECT on the table: - either convert that perl script to C (maybe using libwww and a regex C library); - or simpy launch that perl script from the trigger; The former solution is not easy, and is probably a good programming exercise, the latter is quick but how would one go about launching a perl script from C without waiting for its completion? Thanks in advance, -- Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.org Parkinson's Law: Work expands to fill the time alloted it.
Вложения
В списке pgsql-hackers по дате отправления: