Re: Writing triggers in C++

Поиск
Список
Период
Сортировка
От Andreas Seltenreich
Тема Re: Writing triggers in C++
Дата
Msg-id 87wt2k8vsf.fsf@gate450.dyndns.org
обсуждение исходный текст
Ответ на Re: Writing triggers in C++  ("Florian G. Pflug" <fgp@phlo.org>)
Список pgsql-hackers
Florian G. Pflug writes:

>>> Maybe we should create some wiki page or pgfoundry project that collects
>>> all glue code, tipps and tricks that people invented to glue C++ into
>>> the postgres backend.
>>
>> If it can be made to work, sure; in techdocs.
>
> I was thinking that two pairs of macros,
> PG_BEGIN_CPP, PG_END_CPP and
> PG_CPP_BEGIN_BACKEND, PG_CPP_END_BACKEND
> should be able to take care of the exception handling issues.
>
> You'd need to wrap any code-block that calls postgres functions that
> might do an elog(ERROR) inside PG_CPP_BEGIN_BACKEND,
> PG_CPP_END_BACKEND.
>
> Vice versa, any block of c++ code that is called from the backend would
> need to start with PG_BEGIN_CPP, and end with PG_END_CPP.

I've made positive experiences with such a setup, although I've spared
the PG_BEGIN_CPP/PG_END_CPP by doing the exception conversion in a C++
language handler that instantiates functors using the portable class
loading technique described in this paper:

<http://www.s11n.net/papers/classloading_cpp.html>

I'd be glad to help out on a pgfoundry project to make C++ a better
citizen for extending postgres.

regards,
andreas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Zeugswetter Andreas ADI SD"
Дата:
Сообщение: Re: HOT WIP Patch - version 1
Следующее
От: "Zeugswetter Andreas ADI SD"
Дата:
Сообщение: Re: HOT WIP Patch - version 1