Re: CStringGetTextDatum and other conversions in server-side code

Поиск
Список
Период
Сортировка
От
Тема Re: CStringGetTextDatum and other conversions in server-side code
Дата
Msg-id 001c01d1753b$cd98d2c0$68ca7840$@andl.org
обсуждение исходный текст
Ответ на Re: CStringGetTextDatum and other conversions in server-side code  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
FWIW here are examples from PL/R for incoming (argument) and outgoing
(result) conversions of scalar values:

  https://github.com/jconway/plr/blob/master/pg_conversion.c#L632
  https://github.com/jconway/plr/blob/master/pg_conversion.c#L1002

That same file also has routines for conversions of more complex data types.
[dmb>]
[dmb>] Thank you for the links. Obviously you've put a lot of effort into this work, and equally obviously you know far
moreabout this than I do. But I think the problem I face is a little different. 

This code shows a programming environment in which both the Postgres and R declarations are in scope, and the code
referencesboth. I can't do that. I don't have any C code or any C API that I can bring into a Postgres scope, and
Postgresdoes not provide a 'pure' C API that can be referenced from another language. 

So what I'm trying to do is to write that 'pure' interface, using a thin layer of C and a chosen set of intermediate
datatypes. [Take a look at https://www.sqlite.org/c3ref/funclist.html to see what I mean by a pure interface.] 

For the fixed types, the Datum format is simple enough, but the variable types are much harder. Text comes as char with
anencoding and I need Unicode. Decimal and time are proprietary formats of some kind, which I would prefer not to have
toaccess directly. And so on. 

I'm making progress, but it's slow. I've got everything else working: SPI queries, decoding tuples, etc. It's just
theseconversions that have me stuck. 

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org







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

Предыдущее
От:
Дата:
Сообщение: Re: CStringGetTextDatum and other conversions in server-side code
Следующее
От: "Premsun Choltanwanich"
Дата:
Сообщение: Re: could not migrate 8.0.13 database with large object data to 9.5.1