Akbar Mokhtarani <akbarm(at)slac(dot)stanford(dot)edu> writes:
> I am desparate to find a way to access array elements from my c/c++
> program. I have stored int and double data as arrays in my tables and need
> to retrieve them from the database. I use a binary cursor to store the
> query results and PQgetvalue gives me a char* pointer to the storage area
> where the data is stored (this is according to the documentation).
What PG version are you using?
In 7.3 and earlier you have to deal with the server's internal
representation, warts and all. (I think what you're getting burnt by is
failing to account for MAXALIGN alignment, but it's hard to be sure
without more detail.)
7.4 and up have a documented, more or less platform-independent
representation, but it's not necessarily any easier to work with since
you do need to be able to convert to whatever internal representation
you want to use.
In any case, you need to read the server-side source code to see what
you're dealing with. None of these details have made it into the SGML
documentation, but they're covered fairly well in the source comments.
regards, tom lane
In response to
pgsql-interfaces by date
|Next:||From: Oliver D.||Date: 2004-10-04 06:01:44|
|Subject: Re: Win32 libpq : Static Link ?|
|Previous:||From: Akbar Mokhtarani||Date: 2004-10-04 04:15:34|
|Subject: Re: Array elements (urgent help needed)|