Re: C++: get value for integral types?
От | Tommi Mäkitalo |
---|---|
Тема | Re: C++: get value for integral types? |
Дата | |
Msg-id | 200211122323.18191.t.maekitalo@epgmbh.de обсуждение исходный текст |
Ответ на | Re: C++: get value for integral types? (Vassil Kriakov <vassilk@yahoo.com>) |
Список | pgsql-general |
Hi, Am Dienstag, 12. November 2002 18:27 schrieb Vassil Kriakov: > If you declared a binary cursor (see example prog in postgresql tech > doc. in libpq section), PQgetvalue() will return the "internal backend > server binary representation" of the value you are getting. So if you > were getting something that's an int, PQgetvalue() will return pointer > to memory where your int is in binary format. > > Hoping that the backend server's way of storing int, float, bool, etc. > is the same as at the client-end, you can re-interpret the char* to a > float* or int*, etc. > That's exactly the problem. What if you have different platforms at server-end and client-end? You can't reliable convert a char* to int* or even worse to float*. The better way is to improve the interface to get some usable typedata and an accessorfunction for int, long, double, bool... There is a thread in pgsql-hackers about "protocol change in 7.4", which talks about it. I feel that using ascii-data is the most robust and portable way. Tommi
В списке pgsql-general по дате отправления: