Re: array_agg and libpq(xx)
От | John R Pierce |
---|---|
Тема | Re: array_agg and libpq(xx) |
Дата | |
Msg-id | 49C2B472.30300@hogranch.com обсуждение исходный текст |
Ответ на | array_agg and libpq(xx) (Grzegorz Jaśkiewicz <gryzman@gmail.com>) |
Ответы |
Re: array_agg and libpq(xx)
|
Список | pgsql-general |
Grzegorz Jaśkiewicz wrote: > Hi, > > Anyone here passed array to C/c++ code via libpq(xx) ?? > Do you mean, fetching the output of a query like SELECT ARRAY['123','456','abc','def']; ? > I need to pass on an array of strings, some of them might contain coma symbol. > I am wondering, if there's anything already in libpq(xx) that would > chop value into an array of char* , or will it just return a string > and it is up to user to chop it. > pgResult = PQexec(pgConn, "select array['123','456','abc','def'];"); pgarray = PQgetvalue(pgResult,0,0); will return a pointer to the ARRAY in postgres format as defined by the typsend/recieve internal functions for the ARRAY type. you would need to walk this and copy the strings comprising the array to your own managed storage (malloc, or whatever) prior to calling PQclear(pgResult). I'm trying to find the docs on what the typsend format for ARRAY looks like and failing.
В списке pgsql-general по дате отправления: