ECPG: Automatic Storage allocation for NULL-pointing output variables

Поиск
Список
Период
Сортировка
От Christof Petig
Тема ECPG: Automatic Storage allocation for NULL-pointing output variables
Дата
Msg-id 3BD6A5B4.BA37DFED@petig-baender.de
обсуждение исходный текст
Ответы Re: ECPG: Automatic Storage allocation for NULL-pointing output variables
Список pgsql-interfaces
Hi there,

I'm looking for an alternative to statically sized character arrays
within ECPG.

E.g. exec sql select relname into :VAR from pg_classes;

It should (!) be possible to obtain this by using pointers which are
initialized to NULL.

It is possible for   integer *var=0;       reading an arbitrary number of integers into a malloced array
and   char *var=0;       reading one arbitrary length string into a malloced character
array

Works perfectly.

But ecpg does not accept   char **var=0;

Is there any way to specify arbitrary strings of any length ?

The code (execute.c:435) has also support for varchar - but how to
declare such a variable length varchar?

And the code (execute.c:432) multiplies the number of tuples with the
longest string. But how to use this code in real life?

Looks like dead code to me (hopefully I'm wrong)

Yours   Christof

PS: I'm willing to implement char**
(allocate tuples*sizeof(char*) + sum(length(tuple[n])+1) bytes,fill the array with pointers,fill the space behind the
arraywith the actual data.This means just one free get's it all.But this code cannot be portable!)
 






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

Предыдущее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: Python interface and Money?
Следующее
От: "nitinpdhavale"
Дата:
Сообщение: variable length arrays (fields)