| От | matt@byrney.com |
|---|---|
| Тема | Re: Maintaining state across function calls |
| Дата | |
| Msg-id | c2c3b5c6351b3e2666235a729d25eb7a.squirrel@localhost обсуждение исходный текст |
| Ответ на | Re: Maintaining state across function calls (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: Maintaining state across function calls
|
| Список | pgsql-general |
> matt@byrney.com writes: >> The question is: what's the "best practice" way of letting a >> C/C++-language function hang onto internal state across calls? > > A static variable for that is a really horrid idea. Instead use > fcinfo->flinfo->fn_extra to point to some workspace palloc'd in the > appropriate context. If you grep the PG sources for fn_extra you'll > find plenty of examples. > > regards, tom lane > Thanks for this. Out of curiosity, why is a static a bad way to do this?
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера