[Libpqxx-general] Dealing with resultsets that include user-defined-types

Maurice Gittens mainmanmauricio at gmail.com
Mon Apr 20 18:58:37 UTC 2009


Hi List,

Given the following example:

CREATE TABLE pair(identity    INTEGER, name TEXT);

INSERT INTO pair(identity, name) VALUES(10, 'A name');

CREATE OR REPLACE FUNCTION getPair(id INTEGER) RETURNS pair AS $$

   SELECT * FROM PAIR where identity = $1;

$$ LANGUAGE SQL;

Given the function invocation: SELECT getPair(10);

The result set includes a User defined Type.

What is the recommended way to retrieve the user defined type using pqxx?

I'm hoping I can write something like: resultset[0][0].as<std::pair<int,
std::string>>();
I could not find any examples of this sort of thing.

Any pointers?

Kind regards,
Maurice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/libpqxx-general/attachments/20090420/1bbe187d/attachment.html 


More information about the Libpqxx-general mailing list